SlideShare a Scribd company logo
1 of 27
JPA 2.0 What’s new? Emiel Paasschens Ref. implemenatie van EclipseLink is bijlange (met name Criteria API) nanognietaf, dus… GEEN Hands-On of tochwel…
Programma ,[object Object]
 Mixed @AccessType
 Derived Identifiers
 @ElementCollection
Undirectional @OneToMany / @OneToOne
 @OrderColumn
Shared Cache API
Locking
 JP QL
 Expression and criteria API
HandsOn?
Drankjeaan de bar,[object Object]
javax.persistence.jdbc.url 	driver-specific URL
javax.persistence.jdbc.user 	username used by database connection
javax.persistence.jdbc.password 	password for database connection validation  EE and SE: ,[object Object]
javax.persistence.query.timeoutvalue in milliseconds for query timeout
javax.persistence.validation.group.pre-persist	groups that are targeted for validation upon the pre-persist event
javax.persistence.validation.group.pre-update	groups that are targeted for validation upon the pre-update event
javax.persistence.validation.group.pre-remove	groups that are targeted for validation upon the pre-remove event,[object Object]
Can be mixed now! (instead of one or the other)At Entity/Class level the default Access type is defined
Can be set per attribute to differ from default: - on field (declaration) @Access(FIELD) access directly on instance variable by pers.prov.- on property (getter accessor) @Access(PROPERTY) access via accessor methods by pers. prov.
Be aware: @Access(PROPERTY):- validation/conversion logic in accessor methods is executed!- exceptions are catched and wrapped in PersistenceException, which is thrown. Transactions are marked for rollback.
The access type of an embeddable class is determined by the access type class in which it is embedded, independent of the containing class.,[object Object]
Derived Identifiers (1) Old JPA 1.0 way: ,[object Object]
 Require an additional foreign key field
 Indicate one of the mappings as read only

More Related Content

What's hot

Hibernate working with criteria- Basic Introduction
Hibernate working with criteria- Basic IntroductionHibernate working with criteria- Basic Introduction
Hibernate working with criteria- Basic IntroductionEr. Gaurav Kumar
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotationjavatwo2011
 
Hibernate complete Training
Hibernate complete TrainingHibernate complete Training
Hibernate complete Trainingsourabh aggarwal
 
Introduction to JPA (JPA version 2.0)
Introduction to JPA (JPA version 2.0)Introduction to JPA (JPA version 2.0)
Introduction to JPA (JPA version 2.0)ejlp12
 
Java EE 與 雲端運算的展望
Java EE 與 雲端運算的展望 Java EE 與 雲端運算的展望
Java EE 與 雲端運算的展望 javatwo2011
 
Spring framework part 2
Spring framework part 2Spring framework part 2
Spring framework part 2Haroon Idrees
 
JAX-RS 2.0: New and Noteworthy in RESTful Web Services API - Arun Gupta
JAX-RS 2.0: New and Noteworthy in RESTful Web Services API - Arun GuptaJAX-RS 2.0: New and Noteworthy in RESTful Web Services API - Arun Gupta
JAX-RS 2.0: New and Noteworthy in RESTful Web Services API - Arun GuptaJAX London
 
Dependency injection - the right way
Dependency injection - the right wayDependency injection - the right way
Dependency injection - the right wayThibaud Desodt
 

What's hot (19)

Hibernate working with criteria- Basic Introduction
Hibernate working with criteria- Basic IntroductionHibernate working with criteria- Basic Introduction
Hibernate working with criteria- Basic Introduction
 
Jpa 2.1 Application Development
Jpa 2.1 Application DevelopmentJpa 2.1 Application Development
Jpa 2.1 Application Development
 
Jpa
JpaJpa
Jpa
 
hibernate with JPA
hibernate with JPAhibernate with JPA
hibernate with JPA
 
Java persistence api 2.1
Java persistence api 2.1Java persistence api 2.1
Java persistence api 2.1
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotation
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
Hibernate complete Training
Hibernate complete TrainingHibernate complete Training
Hibernate complete Training
 
JPA and Hibernate
JPA and HibernateJPA and Hibernate
JPA and Hibernate
 
CDI @javaonehyderabad
CDI @javaonehyderabadCDI @javaonehyderabad
CDI @javaonehyderabad
 
TY.BSc.IT Java QB U1
TY.BSc.IT Java QB U1TY.BSc.IT Java QB U1
TY.BSc.IT Java QB U1
 
Introduction to JPA (JPA version 2.0)
Introduction to JPA (JPA version 2.0)Introduction to JPA (JPA version 2.0)
Introduction to JPA (JPA version 2.0)
 
Java EE 與 雲端運算的展望
Java EE 與 雲端運算的展望 Java EE 與 雲端運算的展望
Java EE 與 雲端運算的展望
 
Spring framework part 2
Spring framework part 2Spring framework part 2
Spring framework part 2
 
JAX-RS 2.0: New and Noteworthy in RESTful Web Services API - Arun Gupta
JAX-RS 2.0: New and Noteworthy in RESTful Web Services API - Arun GuptaJAX-RS 2.0: New and Noteworthy in RESTful Web Services API - Arun Gupta
JAX-RS 2.0: New and Noteworthy in RESTful Web Services API - Arun Gupta
 
Jstl 8
Jstl 8Jstl 8
Jstl 8
 
Hibernate III
Hibernate IIIHibernate III
Hibernate III
 
Dependency injection - the right way
Dependency injection - the right wayDependency injection - the right way
Dependency injection - the right way
 
Hibernate in Nutshell
Hibernate in NutshellHibernate in Nutshell
Hibernate in Nutshell
 

Viewers also liked

Perbup 51 tahun 2016 pengembangan kemitraan wirausaha muda di kabupaten pes...
Perbup 51 tahun 2016   pengembangan kemitraan wirausaha muda di kabupaten pes...Perbup 51 tahun 2016   pengembangan kemitraan wirausaha muda di kabupaten pes...
Perbup 51 tahun 2016 pengembangan kemitraan wirausaha muda di kabupaten pes...efendi suyanto
 
quickguide-einnovator-4-cloudfoundry
quickguide-einnovator-4-cloudfoundryquickguide-einnovator-4-cloudfoundry
quickguide-einnovator-4-cloudfoundryjorgesimao71
 
자바병렬프로그래밍 9.gui 애플리케이션
자바병렬프로그래밍 9.gui 애플리케이션자바병렬프로그래밍 9.gui 애플리케이션
자바병렬프로그래밍 9.gui 애플리케이션Choonghyun Yang
 
Launching a product in an Overseas market(Packaged Drinking Water in Indonesia)
Launching a product in an Overseas market(Packaged Drinking Water in Indonesia)Launching a product in an Overseas market(Packaged Drinking Water in Indonesia)
Launching a product in an Overseas market(Packaged Drinking Water in Indonesia)Shaurya Vikram Singh
 
What’s New in Documentum 7.3
What’s New in Documentum 7.3What’s New in Documentum 7.3
What’s New in Documentum 7.3Michael Mohen
 
Benefit-risk Assessment for Including Dairy Foods in the Diet
Benefit-risk Assessment for Including Dairy Foods in the DietBenefit-risk Assessment for Including Dairy Foods in the Diet
Benefit-risk Assessment for Including Dairy Foods in the DietNicoleGeurin
 
Bioaccumulation - Ecosystems
Bioaccumulation - EcosystemsBioaccumulation - Ecosystems
Bioaccumulation - EcosystemsHaileybury
 
Industrial Programming Java - Lection Pack 02 - Distributed applications - La...
Industrial Programming Java - Lection Pack 02 - Distributed applications - La...Industrial Programming Java - Lection Pack 02 - Distributed applications - La...
Industrial Programming Java - Lection Pack 02 - Distributed applications - La...Fedor Lavrentyev
 
Industrial Programming Java - Lection Pack 01 - Building an application - Lav...
Industrial Programming Java - Lection Pack 01 - Building an application - Lav...Industrial Programming Java - Lection Pack 01 - Building an application - Lav...
Industrial Programming Java - Lection Pack 01 - Building an application - Lav...Fedor Lavrentyev
 
Enviornmental protection Act 1986
Enviornmental protection Act 1986Enviornmental protection Act 1986
Enviornmental protection Act 1986Charu Jaiswal
 
Restaurant management in Russia
Restaurant management in RussiaRestaurant management in Russia
Restaurant management in RussiaAnatoly Odintsov
 

Viewers also liked (17)

Perbup 51 tahun 2016 pengembangan kemitraan wirausaha muda di kabupaten pes...
Perbup 51 tahun 2016   pengembangan kemitraan wirausaha muda di kabupaten pes...Perbup 51 tahun 2016   pengembangan kemitraan wirausaha muda di kabupaten pes...
Perbup 51 tahun 2016 pengembangan kemitraan wirausaha muda di kabupaten pes...
 
quickguide-einnovator-4-cloudfoundry
quickguide-einnovator-4-cloudfoundryquickguide-einnovator-4-cloudfoundry
quickguide-einnovator-4-cloudfoundry
 
Damen4Design
Damen4DesignDamen4Design
Damen4Design
 
자바병렬프로그래밍 9.gui 애플리케이션
자바병렬프로그래밍 9.gui 애플리케이션자바병렬프로그래밍 9.gui 애플리케이션
자바병렬프로그래밍 9.gui 애플리케이션
 
Launching a product in an Overseas market(Packaged Drinking Water in Indonesia)
Launching a product in an Overseas market(Packaged Drinking Water in Indonesia)Launching a product in an Overseas market(Packaged Drinking Water in Indonesia)
Launching a product in an Overseas market(Packaged Drinking Water in Indonesia)
 
What’s New in Documentum 7.3
What’s New in Documentum 7.3What’s New in Documentum 7.3
What’s New in Documentum 7.3
 
Spring boot
Spring bootSpring boot
Spring boot
 
Benefit-risk Assessment for Including Dairy Foods in the Diet
Benefit-risk Assessment for Including Dairy Foods in the DietBenefit-risk Assessment for Including Dairy Foods in the Diet
Benefit-risk Assessment for Including Dairy Foods in the Diet
 
Crop production
Crop productionCrop production
Crop production
 
Lecture 42
Lecture 42Lecture 42
Lecture 42
 
Battle of plassey
Battle of plasseyBattle of plassey
Battle of plassey
 
Bioaccumulation - Ecosystems
Bioaccumulation - EcosystemsBioaccumulation - Ecosystems
Bioaccumulation - Ecosystems
 
Industrial Programming Java - Lection Pack 02 - Distributed applications - La...
Industrial Programming Java - Lection Pack 02 - Distributed applications - La...Industrial Programming Java - Lection Pack 02 - Distributed applications - La...
Industrial Programming Java - Lection Pack 02 - Distributed applications - La...
 
Industrial Programming Java - Lection Pack 01 - Building an application - Lav...
Industrial Programming Java - Lection Pack 01 - Building an application - Lav...Industrial Programming Java - Lection Pack 01 - Building an application - Lav...
Industrial Programming Java - Lection Pack 01 - Building an application - Lav...
 
Enviornmental protection Act 1986
Enviornmental protection Act 1986Enviornmental protection Act 1986
Enviornmental protection Act 1986
 
Restaurant management in Russia
Restaurant management in RussiaRestaurant management in Russia
Restaurant management in Russia
 
Internet security
Internet securityInternet security
Internet security
 

Similar to JPA 2.0

Executing Sql Commands
Executing Sql CommandsExecuting Sql Commands
Executing Sql Commandsphanleson
 
Executing Sql Commands
Executing Sql CommandsExecuting Sql Commands
Executing Sql Commandsleminhvuong
 
Codecamp iasi-26 nov 2011-what's new in jpa 2.0
Codecamp iasi-26 nov 2011-what's new in jpa 2.0Codecamp iasi-26 nov 2011-what's new in jpa 2.0
Codecamp iasi-26 nov 2011-what's new in jpa 2.0Codecamp Romania
 
JDBC for CSQL Database
JDBC for CSQL DatabaseJDBC for CSQL Database
JDBC for CSQL Databasejitendral
 
Tk2323 lecture 9 api json
Tk2323 lecture 9   api jsonTk2323 lecture 9   api json
Tk2323 lecture 9 api jsonMengChun Lam
 
Unit test candidate solutions
Unit test candidate solutionsUnit test candidate solutions
Unit test candidate solutionsbenewu
 
Top 10 Web Security Vulnerabilities
Top 10 Web Security VulnerabilitiesTop 10 Web Security Vulnerabilities
Top 10 Web Security VulnerabilitiesCarol McDonald
 
Accelerated data access
Accelerated data accessAccelerated data access
Accelerated data accessgordonyorke
 
Introduction to Spring MVC
Introduction to Spring MVCIntroduction to Spring MVC
Introduction to Spring MVCRichard Paul
 
Designing REST API automation tests in Kotlin
Designing REST API automation tests in KotlinDesigning REST API automation tests in Kotlin
Designing REST API automation tests in KotlinDmitriy Sobko
 
Alexey Tsoy Meta Programming in C++ 16.11.17
Alexey Tsoy Meta Programming in C++ 16.11.17Alexey Tsoy Meta Programming in C++ 16.11.17
Alexey Tsoy Meta Programming in C++ 16.11.17LogeekNightUkraine
 
Asp.net MVC - Course 2
Asp.net MVC - Course 2Asp.net MVC - Course 2
Asp.net MVC - Course 2erdemergin
 

Similar to JPA 2.0 (20)

JDBC – Java Database Connectivity
JDBC – Java Database ConnectivityJDBC – Java Database Connectivity
JDBC – Java Database Connectivity
 
Executing Sql Commands
Executing Sql CommandsExecuting Sql Commands
Executing Sql Commands
 
Executing Sql Commands
Executing Sql CommandsExecuting Sql Commands
Executing Sql Commands
 
Codecamp iasi-26 nov 2011-what's new in jpa 2.0
Codecamp iasi-26 nov 2011-what's new in jpa 2.0Codecamp iasi-26 nov 2011-what's new in jpa 2.0
Codecamp iasi-26 nov 2011-what's new in jpa 2.0
 
Sqlapi0.1
Sqlapi0.1Sqlapi0.1
Sqlapi0.1
 
ORM JPA
ORM JPAORM JPA
ORM JPA
 
JDBC for CSQL Database
JDBC for CSQL DatabaseJDBC for CSQL Database
JDBC for CSQL Database
 
Tk2323 lecture 9 api json
Tk2323 lecture 9   api jsonTk2323 lecture 9   api json
Tk2323 lecture 9 api json
 
Java beans
Java beansJava beans
Java beans
 
Java 17
Java 17Java 17
Java 17
 
Sql injection
Sql injectionSql injection
Sql injection
 
Unit test candidate solutions
Unit test candidate solutionsUnit test candidate solutions
Unit test candidate solutions
 
Top 10 Web Security Vulnerabilities
Top 10 Web Security VulnerabilitiesTop 10 Web Security Vulnerabilities
Top 10 Web Security Vulnerabilities
 
Accelerated data access
Accelerated data accessAccelerated data access
Accelerated data access
 
Jdbc
JdbcJdbc
Jdbc
 
Introduction to Spring MVC
Introduction to Spring MVCIntroduction to Spring MVC
Introduction to Spring MVC
 
Designing REST API automation tests in Kotlin
Designing REST API automation tests in KotlinDesigning REST API automation tests in Kotlin
Designing REST API automation tests in Kotlin
 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
 
Alexey Tsoy Meta Programming in C++ 16.11.17
Alexey Tsoy Meta Programming in C++ 16.11.17Alexey Tsoy Meta Programming in C++ 16.11.17
Alexey Tsoy Meta Programming in C++ 16.11.17
 
Asp.net MVC - Course 2
Asp.net MVC - Course 2Asp.net MVC - Course 2
Asp.net MVC - Course 2
 

More from Emiel Paasschens

ACM Patterns and Oracle BPM Suite Best Practises
ACM Patterns and Oracle BPM Suite Best PractisesACM Patterns and Oracle BPM Suite Best Practises
ACM Patterns and Oracle BPM Suite Best PractisesEmiel Paasschens
 
Introduction of Java 8 with emphasis on Lambda Expressions and Streams
Introduction of Java 8 with emphasis on Lambda Expressions and StreamsIntroduction of Java 8 with emphasis on Lambda Expressions and Streams
Introduction of Java 8 with emphasis on Lambda Expressions and StreamsEmiel Paasschens
 
Boost JD Edwards EnterpriseOne with Oracle SOA Suite for maximum business value
Boost JD Edwards EnterpriseOne with Oracle SOA Suite for maximum business valueBoost JD Edwards EnterpriseOne with Oracle SOA Suite for maximum business value
Boost JD Edwards EnterpriseOne with Oracle SOA Suite for maximum business valueEmiel Paasschens
 
XML Business Rules Validation with Schematron
XML Business Rules Validation with SchematronXML Business Rules Validation with Schematron
XML Business Rules Validation with SchematronEmiel Paasschens
 
Cookbook Oracle SOA Business Rules
Cookbook Oracle SOA Business RulesCookbook Oracle SOA Business Rules
Cookbook Oracle SOA Business RulesEmiel Paasschens
 

More from Emiel Paasschens (6)

ACM Patterns and Oracle BPM Suite Best Practises
ACM Patterns and Oracle BPM Suite Best PractisesACM Patterns and Oracle BPM Suite Best Practises
ACM Patterns and Oracle BPM Suite Best Practises
 
Schematron
SchematronSchematron
Schematron
 
Introduction of Java 8 with emphasis on Lambda Expressions and Streams
Introduction of Java 8 with emphasis on Lambda Expressions and StreamsIntroduction of Java 8 with emphasis on Lambda Expressions and Streams
Introduction of Java 8 with emphasis on Lambda Expressions and Streams
 
Boost JD Edwards EnterpriseOne with Oracle SOA Suite for maximum business value
Boost JD Edwards EnterpriseOne with Oracle SOA Suite for maximum business valueBoost JD Edwards EnterpriseOne with Oracle SOA Suite for maximum business value
Boost JD Edwards EnterpriseOne with Oracle SOA Suite for maximum business value
 
XML Business Rules Validation with Schematron
XML Business Rules Validation with SchematronXML Business Rules Validation with Schematron
XML Business Rules Validation with Schematron
 
Cookbook Oracle SOA Business Rules
Cookbook Oracle SOA Business RulesCookbook Oracle SOA Business Rules
Cookbook Oracle SOA Business Rules
 

Recently uploaded

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Recently uploaded (20)

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

JPA 2.0

  • 1. JPA 2.0 What’s new? Emiel Paasschens Ref. implemenatie van EclipseLink is bijlange (met name Criteria API) nanognietaf, dus… GEEN Hands-On of tochwel…
  • 2.
  • 11. Expression and criteria API
  • 13.
  • 16.
  • 18. javax.persistence.validation.group.pre-persist groups that are targeted for validation upon the pre-persist event
  • 19. javax.persistence.validation.group.pre-update groups that are targeted for validation upon the pre-update event
  • 20.
  • 21. Can be mixed now! (instead of one or the other)At Entity/Class level the default Access type is defined
  • 22. Can be set per attribute to differ from default: - on field (declaration) @Access(FIELD) access directly on instance variable by pers.prov.- on property (getter accessor) @Access(PROPERTY) access via accessor methods by pers. prov.
  • 23. Be aware: @Access(PROPERTY):- validation/conversion logic in accessor methods is executed!- exceptions are catched and wrapped in PersistenceException, which is thrown. Transactions are marked for rollback.
  • 24.
  • 25.
  • 26. Require an additional foreign key field
  • 27. Indicate one of the mappings as read only
  • 28. Duplicate mapping info@Entity public class Part { @Id Integer partNo; @Column(name=“SUPP_ID”) @Id Integer suppId; ... @ManyToOne(insertable=false, updatable=false) @JoinColumn(name=“SUPP_ID”) Supplier supplier; ... }
  • 29.
  • 30.
  • 31.
  • 32. Can be combined with existing @Column (only with basic type) and @OrderBy annotations
  • 33.
  • 34. Undirectional @OneToMany / @OneToOne @OneToMany Mapping with @JoinColumn on parent side:   @Entity public class Vehicle { ... @OneToMany @JoinColumn(name=”VEHIC”) List<Parts> parts; ... }   Also applies to @OneToOne With JPA 1.0 you had to define relation on both sides (necessary to specify columnname)
  • 35.
  • 36. Stores the order in separate DB column, so preferable do not use!  insert object at begin of list causes lots of updates!
  • 37.
  • 38.
  • 39. evict?  how about objects pointing to these evicting instances…
  • 41.
  • 42.
  • 43.
  • 44. CLASS() in WHERE clause (kind of JP QL ‘instanceof’):SELECT e FROM Employee e WHERE CLASS(e) = FullTimeEmployee
  • 45. Collection param from IN:SELECT e FROM Employee eWHERE e.id IN [:selectedIds]
  • 46.
  • 47.
  • 48. Object Model totally been refactored (no more DomainObject or QueryDefinition objects)
  • 49. CriteriaQueryrepresents JP QL in an object way
  • 50. The query Root object defined by the from method and is analog to the “Employee e” in JP QL: SELECT e FROM Employee e
  • 51. new Query object is created by passing CriteriaQuery to em.createQuery.
  • 52.
  • 53. Also applies for and(), or() and not(), methods of the QueryBuilder API
  • 54. The same accounts for methods in the select: max(), min(), sum(), prod(), etc
  • 55. But the orderBy(), groupBy() and having() are methods of the CriteriaQueryobject!
  • 56. And function desc() and asc() are methods of the QueryBuilderobject !!Pro is type safe and no need any more to execute logic code twice when dynamically constructing a query comparing with JP QL (where one time parse is needed to construct the query query and one more to bind the bind params). Con : quite complex and hard to read, so from maintenance perspective…
  • 57. Expression & criteria API (code) Query q = em.createQuery(“SELECT a FROM Account a”); QueryBuilderqb = em.getQueryBuilder();CriteriaQuerycq = qb.create(); Root<Account> account = cq.from(Account.class); cq.select(account); Query q = em.createQuery(cq); List<Account> list = q. getResultList();  
  • 58. Expression & criteria API (code) SELECT c.name FROM Customer c JOIN c.orders o JOIN o.lineitemsi WHERE i.product.productType = ‘printer’ CriteriaQuery q = qb.create(); Root<Customer> cust = q.from(Customer.class); Join<Customer, Order> order = cust.join(Customer_.orders); Join<Order, Item> item = order.join(Order_.lineitems); q.select(cust.get(Customer_.name)) .where(qb.equal(item.get(Item_.product).get(Product_.productType), "printer"));
  • 59. Expression & criteria API (code) Joins can be chained, resulting into:  CriteriaQueryq = qb.create(); Root<Customer> cust = q.from(Customer.class); Join<Order,Item> item = cust.join(Customer_.orders).join(Order_.lineitems); q.select(cust.get(Customer_.name)) .where(qb.equal(item.get(Item_.product).get(Product_.productType), "printer"));    Outer join with param on the join: SELECT c FROM Customer c LEFT JOIN c.orders o WHERE c.status = 1   CriteriaQuery q = qb.create(); Root<Customer> cust = q.from(Customer.class); Join<Customer, Order> order = cust.join(Customer_.orders, JoinType.LEFT); q.where(qb.equal(cust.get(Customer_.status), 1)).select(cust);
  • 60. Expression & criteria API (code) Example with ContactInfo as Embeddable class containing address and set of Phones.   SELECT p.vendor FROM Employee e JOIN e.contactInfo.phones p WHERE e.contactInfo.address.zipcode = '95054'   CriteriaQuery q = qb.create(); Root<Employee> emp = q.from(Employee.class); Join<ContactInfo, Phone> phone = emp.join(Employee_.contactInfo).join(ContactInfo_.phones); q.where(qb.equal(emp.get(Employee_.contactInfo).get( ContactInfo_.address).get(Address_.zipcode), "95054")).select(phone.get(Phone_.vendor));
  • 61. Expression & criteria API (code) Example with subquery using all:SELECT emp FROM Employee emp WHERE emp.salary > ALL (SELECT m.salary FROM Manager m WHERE m.department = emp.department)    // create CriteriaQuery instance, with root Employee CriteriaQuery q = qb.create(); Root<Employee> emp = q.from(Employee.class);   // create Subquery instance, with root Manager Subquery<BigDecimal> sq = q.subquery(BigDecimal.class); Root<Manager> manager = sq.from(Manager.class); sq.select(manager.get(Manager_.salary)); sq.where(qb.equal(manager.get(Manager_.dept), emp.get(Employee_.dept)));   // an all expression is applied to the subquery result q.select(emp).where(qb.gt(emp.get(Employee_.salary), qb.all(sq)));
  • 62. Expression & criteria API (code) Example with order by: SELECT o.quantity, a.zipcode FROM Customer c JOIN c.orders o JOIN c.address a WHERE a.state = 'CA’ ORDER BY o.quantity, a.zipcode CriteriaQuery q = qb.create(); Root<Customer> c = q.from(Customer.class); Join<Customer, Order> o = c.join(Customer_.orders); Join<Customer, Address> a = c.join(Customer_.address); q.where(qb.equal(a.get(Address_.state), "CA")); q.orderBy(qb.asc(o.get(Order_.quantity)), qb.asc(a.get(Address_.zipcode))); q.select(o.get(Order_.quantity), a.get(Address_.zipcode));
  • 63. Expression & criteria API (code) Example with group by and having: SELECT c.status, AVG(c.filledOrderCount), COUNT(c) FROM Customer c GROUP BY c.status HAVING c.status IN (1, 2) CriteriaQuery q = qb.create(); Root<Customer> cust = q.from(Customer.class); q.groupBy(cust.get(Customer_.status)); q.having(qb.in(cust.get(Customer_.status)).value(1).value(2)); q.select(cust.get(Customer_.status), qb.avg(cust.get(Customer_.filledOrderCount)), qb.count(cust));
  • 64.
  • 65. Training door Oracle ACE’s en ACE Director

Editor's Notes

  1. These defined properties must be implemented by each vendor (aside from vendor specific properties)
  2. Let op! Mark @Transient anderswordtdezewegens default FIELD access ookgepersisteerd.