SlideShare a Scribd company logo
1 of 15
Download to read offline
JEE KURZUS 2. HÉT
SETENY.JANOS@TIGRA.HU
1
IntelliJ gyorsítóbillentyűk
Ezek nem lesznek ZH kérdések

Ctrl+Shift+A - parancsok
kikeresése és végrehajtása

Java Class 

új class készítése

Show Usages

Refactor This …

Ctrl + B - deklarációra ugrás

Ctrl + Szóköz illetve Ctrl + Shift +
Szóköz - kód kiegészítés

Alt + F12 - Terminál
2
F2 illetve Shift + F2 

következő illetve előző hiba

Ctrl + W - kijelölés tágítása

Ctrl + Shift + W szűkítésa

Alt + 1 … 9 - Tool ablakok

Ctrl + E - előző fájlok

Ctrl + Shift + Backspace

előző szerkesztés helye

Ctrl + K, Ctrl + T - git VCS
kezelése, fontos: Reformat Code

További esetleges
gyorsítóbillentyűk
Első lépések
Ezek nem lesznek ZH kérdések

sudo apt-get update

sudo apt-get install maven

mvn -version

Ha nem Ubuntu, akkor az alábbi:

wget http://xenia.sote.hu/ftp/mirrors/www.apache.org/maven/
maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz

git clone https://github.com/jseteny/tigra-jee-kurzus

Ezt IntelliJ-vel fogjuk csinálni. Most csak nézzük meg, hogy van-e git?

https://www.jetbrains.com/shop/eform/students
3
4
5
6
7
8
9
10
A JEE kurzus folyamán nem fogunk Scala nyelvet használni,
viszont javaslom a funkcionális programozással való
megismerkedést otthon Scala használatával.
A Scala nyelv Java VM-en és Java lib-ekkel (jar-okkal)
használható.
Gyorsabban készülő nagyobb, mégis kevésbé komplex
rendszerek hatékony nyelve. Többek között az alábbi cégek
használják: Twitter, Linkedin, Coursera, Samsung, Verizon
JPA és validációs annotációk
@Id - ID típusú mező. Primary key az
adatbázisban (DB)

@GeneratedValue - DB által generált

@Size - min és max méret

@NotNull - kötelező mező

@NotEmpty - Nem üres String
11
1. Feladat
Car Entity class létrehozása a következő mezőkkel

owner

licensePlateNumber

type

fuel

Amikor a megfelelő mezőket a megfelelő annotációkkal
létrehoztad a get/set metódusokat az alábbi módon készítsd

Ctr + Shift + A, Generate …

Getter and Setter, Ctrl + A, Enter
12
2. Feladat
@RunWith(Arquillian.class)

public class CarRegistrationTest

Az alábbi tartalmú teszt metódus

Member objektum létrehozása

Car objektum létrehozása, majd az alábbiak elvégzése vele

Persist-álása

Visszaolvasása

assertEquals hívása a létrehozott és a visszaolvasott autók
rendszámára
13
3. Teszt futtatása
Alt + F12 (Terminal)

~/wildfly-10.0.0.Final/bin/standalone.sh

pom.xml -ben arq-wildfly-remote keresése

<artifactId> tartalmának kijelölése 

és Ctrl + C

Ctrl + Shift + A, Edit Configurations …

+ majd Arquillian JUnit kiválasztása

Configure gomb a jobb oldalon

+ majd Manual container configuration

+ a jobb szélen majd Maven Dependency

Kb 30%-al szélesebbre húzni a dialog
ablakot
14
Ctrl + V, az elvárt eredmény: wildfly-
arquillian-container-remote

Bepipálni a Download to-t

… 8.2.1.Final-t választani a végéről és OK
javax.persistence.TransactionRequiredException: WFLYJPA0060: Transaction is required to perform
this operation (either use a transaction or extended persistence context)

@Inject

private EntityManager em;

...


em.persist(car); <<<
Probléma:
15
@Inject

private CarRegistration carRegistration;
…


carRegistration.register(car);



Megoldás:
@Stateless

public class CarRegistration {



@Inject

private Logger log;



@Inject

private EntityManager em;



@Inject

private Event<Car> memberEventSrc;



public void register(Car car) throws Exception {

log.info("Registering " + car.getLicensePlateNumber());

em.persist(car);

memberEventSrc.fire(car);

}

}

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Jee kurzus 2. het

  • 1. JEE KURZUS 2. HÉT SETENY.JANOS@TIGRA.HU 1
  • 2. IntelliJ gyorsítóbillentyűk Ezek nem lesznek ZH kérdések Ctrl+Shift+A - parancsok kikeresése és végrehajtása Java Class 
 új class készítése Show Usages Refactor This … Ctrl + B - deklarációra ugrás Ctrl + Szóköz illetve Ctrl + Shift + Szóköz - kód kiegészítés Alt + F12 - Terminál 2 F2 illetve Shift + F2 
 következő illetve előző hiba Ctrl + W - kijelölés tágítása Ctrl + Shift + W szűkítésa Alt + 1 … 9 - Tool ablakok Ctrl + E - előző fájlok Ctrl + Shift + Backspace
 előző szerkesztés helye Ctrl + K, Ctrl + T - git VCS kezelése, fontos: Reformat Code További esetleges gyorsítóbillentyűk
  • 3. Első lépések Ezek nem lesznek ZH kérdések sudo apt-get update sudo apt-get install maven mvn -version Ha nem Ubuntu, akkor az alábbi: wget http://xenia.sote.hu/ftp/mirrors/www.apache.org/maven/ maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz git clone https://github.com/jseteny/tigra-jee-kurzus
 Ezt IntelliJ-vel fogjuk csinálni. Most csak nézzük meg, hogy van-e git? https://www.jetbrains.com/shop/eform/students 3
  • 4. 4
  • 5. 5
  • 6. 6
  • 7. 7
  • 8. 8
  • 9. 9
  • 10. 10 A JEE kurzus folyamán nem fogunk Scala nyelvet használni, viszont javaslom a funkcionális programozással való megismerkedést otthon Scala használatával. A Scala nyelv Java VM-en és Java lib-ekkel (jar-okkal) használható. Gyorsabban készülő nagyobb, mégis kevésbé komplex rendszerek hatékony nyelve. Többek között az alábbi cégek használják: Twitter, Linkedin, Coursera, Samsung, Verizon
  • 11. JPA és validációs annotációk @Id - ID típusú mező. Primary key az adatbázisban (DB) @GeneratedValue - DB által generált @Size - min és max méret @NotNull - kötelező mező @NotEmpty - Nem üres String 11
  • 12. 1. Feladat Car Entity class létrehozása a következő mezőkkel owner licensePlateNumber type fuel Amikor a megfelelő mezőket a megfelelő annotációkkal létrehoztad a get/set metódusokat az alábbi módon készítsd Ctr + Shift + A, Generate … Getter and Setter, Ctrl + A, Enter 12
  • 13. 2. Feladat @RunWith(Arquillian.class)
 public class CarRegistrationTest Az alábbi tartalmú teszt metódus Member objektum létrehozása Car objektum létrehozása, majd az alábbiak elvégzése vele Persist-álása Visszaolvasása assertEquals hívása a létrehozott és a visszaolvasott autók rendszámára 13
  • 14. 3. Teszt futtatása Alt + F12 (Terminal) ~/wildfly-10.0.0.Final/bin/standalone.sh pom.xml -ben arq-wildfly-remote keresése <artifactId> tartalmának kijelölése 
 és Ctrl + C Ctrl + Shift + A, Edit Configurations … + majd Arquillian JUnit kiválasztása Configure gomb a jobb oldalon + majd Manual container configuration + a jobb szélen majd Maven Dependency Kb 30%-al szélesebbre húzni a dialog ablakot 14 Ctrl + V, az elvárt eredmény: wildfly- arquillian-container-remote Bepipálni a Download to-t … 8.2.1.Final-t választani a végéről és OK
  • 15. javax.persistence.TransactionRequiredException: WFLYJPA0060: Transaction is required to perform this operation (either use a transaction or extended persistence context)
 @Inject
 private EntityManager em;
 ... 
 em.persist(car); <<< Probléma: 15 @Inject
 private CarRegistration carRegistration; … 
 carRegistration.register(car);
 
 Megoldás: @Stateless
 public class CarRegistration {
 
 @Inject
 private Logger log;
 
 @Inject
 private EntityManager em;
 
 @Inject
 private Event<Car> memberEventSrc;
 
 public void register(Car car) throws Exception {
 log.info("Registering " + car.getLicensePlateNumber());
 em.persist(car);
 memberEventSrc.fire(car);
 }
 }