SlideShare una empresa de Scribd logo
1 de 29
Luis Goldster
 What is Java Persistence API
 Primary Features
 Five Steps to Implement JPA
◦ Download Hibernate Components
◦ Prepare Database, and Download JDBC Driver
◦ Implemented POJO entities and add annotations
◦ Persistence.xml
◦ Implemented client side code via EntityManager
 The Java Persistence API is the standard
object/relational mapping and persistence
management interface of the Java EE 5.0
platform. As part of the EJB 3.0 specification
effort, it is supported by all major vendors of the
Java industry.
Inheritance, polymorphism, etc.Inheritance, polymorphism, etc.
Using annotations and/or XMLUsing annotations and/or XML
Java Application Java Persistence API
Hibernate TopLink Kodo (OpenJPA)
Everyone can use their own favorite persistence technology
Hibernate CoreHibernate Core
Hibernate Annotation (JPA)
Hibernate EntityManager
Hibernate Annotation (JPA)
Hibernate EntityManager
Hibernate Annotation (Hibernate)
Hibernate XML Mapping File
Hibernate Annotation (Hibernate)
Hibernate XML Mapping File
Java Persistence APIJava Persistence API Hibernate APIHibernate API
1. Hibernate Core
2. Hibernate EntityManager
3. Hibernate Annotations
http://www.hibernate.org/
MySQL JDBC Driver
http://tinyurl.com/ymt6rb
1. Hibernate Core
2. Hibernate EntityManager
3. Hibernate Annotations
http://www.hibernate.org/
1. Hibernate Core
2. Hibernate EntityManager
3. Hibernate Annotations
http://www.hibernate.org/
MySQL JDBC Driver
http://tinyurl.com/ymt6rb
MySQL JDBC Driver
http://tinyurl.com/ymt6rb
To label artifacts
(classes, methods etc.) for
persistence or persistence
related operations
To label artifacts
(classes, methods etc.) for
persistence or persistence
related operations
A “gateway” to the
persistence classes
A “gateway” to the
persistence classes
Allow access to persistent
objects, transaction context,
query language etc.
Allow access to persistent
objects, transaction context,
query language etc.
 Hibernate Annotations includes
◦ Standardized Java Persistence and EJB 3.0 (JSR 220)
object/relational mapping annotations
◦ Hibernate-specific extension annotations for performance
optimization and special mappings
 Hibernate EntityManager includes
◦ The standard Java Persistence management API
◦ The standard Java Persistence Query Language
◦ The standard Java Persistence object lifecycle rules
◦ The standard Java Persistence configuration and
packaging
1. Hibernate Core
2. Hibernate EntityManager
3. Hibernate Annotations
http://www.hibernate.org/
1. Hibernate Core
2. Hibernate EntityManager
3. Hibernate Annotations
http://www.hibernate.org/
MySQL JDBC Driver
http://tinyurl.com/ymt6rb
MySQL JDBC Driver
http://tinyurl.com/ymt6rb
 Attached to a class
 Signify that a class is persistent
 Example:
 An entity must follow the Java Bean convention
for its attributes to be persistent
◦ Having getters and setters
 Each entity must have an identity
 An identity of an entity could simply be a class
variable annotated with @Id
 Example
 Id can be auto generated
@Id(generate=GeneratorType.AUTO)
 There are other strategies such as
◦ GeneratorType.SEQUENCE
◦ GeneratorType.IDENTITY
 AUTO is best for portability between database
vendors
 @Column, is put on getter of a class variable
 Has several functionalities
◦ Updatable (boolean)
◦ Nullable (updatable)
◦ Length (int)
◦ Example:
 There are 4 types of links
◦ @OneToOne
◦ @OneToMany
◦ @ManyToOne
◦ @ManyToMany
 In most cases, putting the annotation on a getter
of a class variable would be enough
 In some cases, we need to identify a few
parameters to the annotations
 Two cases
◦ Two entities share the same primary key value
 Entity objects have two distinct modes
◦ Attached
 The object is in the database
◦ Detached
 The object is in memory acting as a DTO
 Modification on detached object would not be persisted
automatically
 Developers need to persist detached objects using a
primitive
 Entity manager:
◦ Gateway to persistent classes
◦ Enable queries
◦ Outside of session beans, provides transaction facility
1. Hibernate Core
2. Hibernate EntityManager
3. Hibernate Annotations
http://www.hibernate.org/
1. Hibernate Core
2. Hibernate EntityManager
3. Hibernate Annotations
http://www.hibernate.org/
MySQL JDBC Driver
http://tinyurl.com/ymt6rb
MySQL JDBC Driver
http://tinyurl.com/ymt6rb
Entity classesEntity classes
JDBC
Driver
JDBC
Driver
JDBC
URL
JDBC
URL
User nameUser name
passwordpassword
EntityManagerFactory
Name
EntityManagerFactory
Name
1. Hibernate Core
2. Hibernate EntityManager
3. Hibernate Annotations
http://www.hibernate.org/
1. Hibernate Core
2. Hibernate EntityManager
3. Hibernate Annotations
http://www.hibernate.org/
MySQL JDBC Driver
http://tinyurl.com/ymt6rb
MySQL JDBC Driver
http://tinyurl.com/ymt6rb
CreateCreate
CreateCreate
OperatesOperates
Persistence.xmlPersistence.xml
Java persistence api
Java persistence api
Java persistence api
Java persistence api

Más contenido relacionado

La actualidad más candente

Entity Persistence with JPA
Entity Persistence with JPAEntity Persistence with JPA
Entity Persistence with JPASubin Sugunan
 
Introduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examplesIntroduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examplesecosio GmbH
 
Introduction to Hibernate Framework
Introduction to Hibernate FrameworkIntroduction to Hibernate Framework
Introduction to Hibernate FrameworkRaveendra R
 
Евгений Капинос "Advanced JPA (Java Persistent API)"
Евгений Капинос "Advanced JPA (Java Persistent API)"Евгений Капинос "Advanced JPA (Java Persistent API)"
Евгений Капинос "Advanced JPA (Java Persistent API)"Anna Shymchenko
 
Hibernate ppt
Hibernate pptHibernate ppt
Hibernate pptAneega
 
Hibernate presentation
Hibernate presentationHibernate presentation
Hibernate presentationManav Prasad
 
Hibernate Presentation
Hibernate  PresentationHibernate  Presentation
Hibernate Presentationguest11106b
 
Spring (1)
Spring (1)Spring (1)
Spring (1)Aneega
 
Hibernate Developer Reference
Hibernate Developer ReferenceHibernate Developer Reference
Hibernate Developer ReferenceMuthuselvam RS
 
Hibernate Basic Concepts - Presentation
Hibernate Basic Concepts - PresentationHibernate Basic Concepts - Presentation
Hibernate Basic Concepts - PresentationKhoa Nguyen
 
Hibernate Interview Questions
Hibernate Interview QuestionsHibernate Interview Questions
Hibernate Interview QuestionsSyed Shahul
 
Introduction to Spring's Dependency Injection
Introduction to Spring's Dependency InjectionIntroduction to Spring's Dependency Injection
Introduction to Spring's Dependency InjectionRichard Paul
 
Intro To Hibernate
Intro To HibernateIntro To Hibernate
Intro To HibernateAmit Himani
 

La actualidad más candente (19)

Entity Persistence with JPA
Entity Persistence with JPAEntity Persistence with JPA
Entity Persistence with JPA
 
Introduction to Hibernate
Introduction to HibernateIntroduction to Hibernate
Introduction to Hibernate
 
Introduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examplesIntroduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examples
 
JPA and Hibernate
JPA and HibernateJPA and Hibernate
JPA and Hibernate
 
Introduction to Hibernate Framework
Introduction to Hibernate FrameworkIntroduction to Hibernate Framework
Introduction to Hibernate Framework
 
Евгений Капинос "Advanced JPA (Java Persistent API)"
Евгений Капинос "Advanced JPA (Java Persistent API)"Евгений Капинос "Advanced JPA (Java Persistent API)"
Евгений Капинос "Advanced JPA (Java Persistent API)"
 
JPA Best Practices
JPA Best PracticesJPA Best Practices
JPA Best Practices
 
Hibernate ppt
Hibernate pptHibernate ppt
Hibernate ppt
 
Hibernate presentation
Hibernate presentationHibernate presentation
Hibernate presentation
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Hibernate Presentation
Hibernate  PresentationHibernate  Presentation
Hibernate Presentation
 
Spring (1)
Spring (1)Spring (1)
Spring (1)
 
Hibernate Developer Reference
Hibernate Developer ReferenceHibernate Developer Reference
Hibernate Developer Reference
 
Hibernate Basic Concepts - Presentation
Hibernate Basic Concepts - PresentationHibernate Basic Concepts - Presentation
Hibernate Basic Concepts - Presentation
 
Jpa 2.1 Application Development
Jpa 2.1 Application DevelopmentJpa 2.1 Application Development
Jpa 2.1 Application Development
 
Hibernate Interview Questions
Hibernate Interview QuestionsHibernate Interview Questions
Hibernate Interview Questions
 
Introduction to Spring's Dependency Injection
Introduction to Spring's Dependency InjectionIntroduction to Spring's Dependency Injection
Introduction to Spring's Dependency Injection
 
Hibernate3 q&a
Hibernate3 q&aHibernate3 q&a
Hibernate3 q&a
 
Intro To Hibernate
Intro To HibernateIntro To Hibernate
Intro To Hibernate
 

Destacado

Spring.Boot up your development
Spring.Boot up your developmentSpring.Boot up your development
Spring.Boot up your developmentStrannik_2013
 
Spring + JPA + DAO Step by Step
Spring + JPA + DAO Step by StepSpring + JPA + DAO Step by Step
Spring + JPA + DAO Step by StepGuo Albert
 
Spring 4. Part 1 - IoC, AOP
Spring 4. Part 1 - IoC, AOPSpring 4. Part 1 - IoC, AOP
Spring 4. Part 1 - IoC, AOPNakraynikov Oleg
 
20160523 hibernate persistence_framework_and_orm
20160523 hibernate persistence_framework_and_orm20160523 hibernate persistence_framework_and_orm
20160523 hibernate persistence_framework_and_ormKenan Sevindik
 
Cassandra for mission critical data
Cassandra for mission critical dataCassandra for mission critical data
Cassandra for mission critical dataOleksandr Semenov
 
DBM專案環境建置
DBM專案環境建置DBM專案環境建置
DBM專案環境建置Guo Albert
 
Get the Most out of Testing with Spring 4.2
Get the Most out of Testing with Spring 4.2Get the Most out of Testing with Spring 4.2
Get the Most out of Testing with Spring 4.2Sam Brannen
 
Google Web Toolkit: a case study
Google Web Toolkit: a case studyGoogle Web Toolkit: a case study
Google Web Toolkit: a case studyBryan Basham
 
Introduction To Spring
Introduction To SpringIntroduction To Spring
Introduction To SpringIlio Catallo
 
Java Persistence API
Java Persistence APIJava Persistence API
Java Persistence APIIlio Catallo
 
C# Variables and Operators
C# Variables and OperatorsC# Variables and Operators
C# Variables and OperatorsSunil OS
 

Destacado (20)

Gradle - Build System
Gradle - Build SystemGradle - Build System
Gradle - Build System
 
Spring Data Jpa
Spring Data JpaSpring Data Jpa
Spring Data Jpa
 
Spring.Boot up your development
Spring.Boot up your developmentSpring.Boot up your development
Spring.Boot up your development
 
Spring
SpringSpring
Spring
 
Spring + JPA + DAO Step by Step
Spring + JPA + DAO Step by StepSpring + JPA + DAO Step by Step
Spring + JPA + DAO Step by Step
 
Spring 4. Part 1 - IoC, AOP
Spring 4. Part 1 - IoC, AOPSpring 4. Part 1 - IoC, AOP
Spring 4. Part 1 - IoC, AOP
 
Java Persistence API
Java Persistence APIJava Persistence API
Java Persistence API
 
20160523 hibernate persistence_framework_and_orm
20160523 hibernate persistence_framework_and_orm20160523 hibernate persistence_framework_and_orm
20160523 hibernate persistence_framework_and_orm
 
Spring Boot Update
Spring Boot UpdateSpring Boot Update
Spring Boot Update
 
Cassandra for mission critical data
Cassandra for mission critical dataCassandra for mission critical data
Cassandra for mission critical data
 
Second Level Cache in JPA Explained
Second Level Cache in JPA ExplainedSecond Level Cache in JPA Explained
Second Level Cache in JPA Explained
 
DBM專案環境建置
DBM專案環境建置DBM專案環境建置
DBM專案環境建置
 
Get the Most out of Testing with Spring 4.2
Get the Most out of Testing with Spring 4.2Get the Most out of Testing with Spring 4.2
Get the Most out of Testing with Spring 4.2
 
JPA - Beyond copy-paste
JPA - Beyond copy-pasteJPA - Beyond copy-paste
JPA - Beyond copy-paste
 
Google Web Toolkit: a case study
Google Web Toolkit: a case studyGoogle Web Toolkit: a case study
Google Web Toolkit: a case study
 
Introduction To Spring
Introduction To SpringIntroduction To Spring
Introduction To Spring
 
Java Persistence API
Java Persistence APIJava Persistence API
Java Persistence API
 
C# Variables and Operators
C# Variables and OperatorsC# Variables and Operators
C# Variables and Operators
 
Spring data jpa
Spring data jpaSpring data jpa
Spring data jpa
 
Spring Data Jpa
Spring Data JpaSpring Data Jpa
Spring Data Jpa
 

Similar a Java persistence api

Java ee 8 + security overview
Java ee 8 + security overviewJava ee 8 + security overview
Java ee 8 + security overviewRudy De Busscher
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Arun Gupta
 
Developing Transactional JEE Apps With Spring
Developing Transactional JEE Apps With SpringDeveloping Transactional JEE Apps With Spring
Developing Transactional JEE Apps With SpringGuy Pardon
 
Owner - Java properties reinvented.
Owner - Java properties reinvented.Owner - Java properties reinvented.
Owner - Java properties reinvented.Luigi Viggiano
 
java classes in pune
java classes in punejava classes in pune
java classes in punecncwebjava
 
EJB 3.0 Java Persistence with Oracle TopLink
EJB 3.0 Java Persistence with Oracle TopLinkEJB 3.0 Java Persistence with Oracle TopLink
EJB 3.0 Java Persistence with Oracle TopLinkBill Lyons
 
Spring training
Spring trainingSpring training
Spring trainingTechFerry
 
Hibernate basics
Hibernate basicsHibernate basics
Hibernate basicsAathikaJava
 
Java Hibernate Basics
Java Hibernate BasicsJava Hibernate Basics
Java Hibernate BasicsDeeptiJava
 

Similar a Java persistence api (20)

Javaee6 Overview
Javaee6 OverviewJavaee6 Overview
Javaee6 Overview
 
Java ee 8 + security overview
Java ee 8 + security overviewJava ee 8 + security overview
Java ee 8 + security overview
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011
 
מתפ
מתפמתפ
מתפ
 
P20CSP105-AdvJavaProg.pptx
P20CSP105-AdvJavaProg.pptxP20CSP105-AdvJavaProg.pptx
P20CSP105-AdvJavaProg.pptx
 
JEE5 New Features
JEE5 New FeaturesJEE5 New Features
JEE5 New Features
 
Java se7 features
Java se7 featuresJava se7 features
Java se7 features
 
Developing Transactional JEE Apps With Spring
Developing Transactional JEE Apps With SpringDeveloping Transactional JEE Apps With Spring
Developing Transactional JEE Apps With Spring
 
Month 3 report
Month 3 reportMonth 3 report
Month 3 report
 
What's new in Java EE 6
What's new in Java EE 6What's new in Java EE 6
What's new in Java EE 6
 
Tu1 1 5l
Tu1 1 5lTu1 1 5l
Tu1 1 5l
 
Owner - Java properties reinvented.
Owner - Java properties reinvented.Owner - Java properties reinvented.
Owner - Java properties reinvented.
 
java classes in pune
java classes in punejava classes in pune
java classes in pune
 
Java J2EE Training in Chennai, Tambaram
Java J2EE  Training in Chennai, TambaramJava J2EE  Training in Chennai, Tambaram
Java J2EE Training in Chennai, Tambaram
 
Java part 3
Java part  3Java part  3
Java part 3
 
EJB 3.0 Java Persistence with Oracle TopLink
EJB 3.0 Java Persistence with Oracle TopLinkEJB 3.0 Java Persistence with Oracle TopLink
EJB 3.0 Java Persistence with Oracle TopLink
 
JBoss AS7 OSDC 2011
JBoss AS7 OSDC 2011JBoss AS7 OSDC 2011
JBoss AS7 OSDC 2011
 
Spring training
Spring trainingSpring training
Spring training
 
Hibernate basics
Hibernate basicsHibernate basics
Hibernate basics
 
Java Hibernate Basics
Java Hibernate BasicsJava Hibernate Basics
Java Hibernate Basics
 

Más de Luis Goldster

Ruby on rails evaluation
Ruby on rails evaluationRuby on rails evaluation
Ruby on rails evaluationLuis Goldster
 
Ado.net & data persistence frameworks
Ado.net & data persistence frameworksAdo.net & data persistence frameworks
Ado.net & data persistence frameworksLuis Goldster
 
Multithreading models.ppt
Multithreading models.pptMultithreading models.ppt
Multithreading models.pptLuis Goldster
 
Business analytics and data mining
Business analytics and data miningBusiness analytics and data mining
Business analytics and data miningLuis Goldster
 
Big picture of data mining
Big picture of data miningBig picture of data mining
Big picture of data miningLuis Goldster
 
Data mining and knowledge discovery
Data mining and knowledge discoveryData mining and knowledge discovery
Data mining and knowledge discoveryLuis Goldster
 
Directory based cache coherence
Directory based cache coherenceDirectory based cache coherence
Directory based cache coherenceLuis Goldster
 
Hardware managed cache
Hardware managed cacheHardware managed cache
Hardware managed cacheLuis Goldster
 
How analysis services caching works
How analysis services caching worksHow analysis services caching works
How analysis services caching worksLuis Goldster
 
Optimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessorsOptimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessorsLuis Goldster
 
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysisLuis Goldster
 
Concurrency with java
Concurrency with javaConcurrency with java
Concurrency with javaLuis Goldster
 

Más de Luis Goldster (20)

Ruby on rails evaluation
Ruby on rails evaluationRuby on rails evaluation
Ruby on rails evaluation
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Lisp and scheme i
Lisp and scheme iLisp and scheme i
Lisp and scheme i
 
Ado.net & data persistence frameworks
Ado.net & data persistence frameworksAdo.net & data persistence frameworks
Ado.net & data persistence frameworks
 
Multithreading models.ppt
Multithreading models.pptMultithreading models.ppt
Multithreading models.ppt
 
Business analytics and data mining
Business analytics and data miningBusiness analytics and data mining
Business analytics and data mining
 
Big picture of data mining
Big picture of data miningBig picture of data mining
Big picture of data mining
 
Data mining and knowledge discovery
Data mining and knowledge discoveryData mining and knowledge discovery
Data mining and knowledge discovery
 
Cache recap
Cache recapCache recap
Cache recap
 
Directory based cache coherence
Directory based cache coherenceDirectory based cache coherence
Directory based cache coherence
 
Hardware managed cache
Hardware managed cacheHardware managed cache
Hardware managed cache
 
How analysis services caching works
How analysis services caching worksHow analysis services caching works
How analysis services caching works
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Optimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessorsOptimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessors
 
Api crash
Api crashApi crash
Api crash
 
Object model
Object modelObject model
Object model
 
Abstraction file
Abstraction fileAbstraction file
Abstraction file
 
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
 
Abstract class
Abstract classAbstract class
Abstract class
 
Concurrency with java
Concurrency with javaConcurrency with java
Concurrency with java
 

Último

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 

Último (20)

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

Java persistence api

  • 2.  What is Java Persistence API  Primary Features  Five Steps to Implement JPA ◦ Download Hibernate Components ◦ Prepare Database, and Download JDBC Driver ◦ Implemented POJO entities and add annotations ◦ Persistence.xml ◦ Implemented client side code via EntityManager
  • 3.  The Java Persistence API is the standard object/relational mapping and persistence management interface of the Java EE 5.0 platform. As part of the EJB 3.0 specification effort, it is supported by all major vendors of the Java industry.
  • 4. Inheritance, polymorphism, etc.Inheritance, polymorphism, etc. Using annotations and/or XMLUsing annotations and/or XML
  • 5. Java Application Java Persistence API Hibernate TopLink Kodo (OpenJPA) Everyone can use their own favorite persistence technology
  • 6. Hibernate CoreHibernate Core Hibernate Annotation (JPA) Hibernate EntityManager Hibernate Annotation (JPA) Hibernate EntityManager Hibernate Annotation (Hibernate) Hibernate XML Mapping File Hibernate Annotation (Hibernate) Hibernate XML Mapping File Java Persistence APIJava Persistence API Hibernate APIHibernate API
  • 7. 1. Hibernate Core 2. Hibernate EntityManager 3. Hibernate Annotations http://www.hibernate.org/ MySQL JDBC Driver http://tinyurl.com/ymt6rb
  • 8. 1. Hibernate Core 2. Hibernate EntityManager 3. Hibernate Annotations http://www.hibernate.org/ 1. Hibernate Core 2. Hibernate EntityManager 3. Hibernate Annotations http://www.hibernate.org/ MySQL JDBC Driver http://tinyurl.com/ymt6rb MySQL JDBC Driver http://tinyurl.com/ymt6rb
  • 9. To label artifacts (classes, methods etc.) for persistence or persistence related operations To label artifacts (classes, methods etc.) for persistence or persistence related operations A “gateway” to the persistence classes A “gateway” to the persistence classes Allow access to persistent objects, transaction context, query language etc. Allow access to persistent objects, transaction context, query language etc.
  • 10.  Hibernate Annotations includes ◦ Standardized Java Persistence and EJB 3.0 (JSR 220) object/relational mapping annotations ◦ Hibernate-specific extension annotations for performance optimization and special mappings  Hibernate EntityManager includes ◦ The standard Java Persistence management API ◦ The standard Java Persistence Query Language ◦ The standard Java Persistence object lifecycle rules ◦ The standard Java Persistence configuration and packaging
  • 11. 1. Hibernate Core 2. Hibernate EntityManager 3. Hibernate Annotations http://www.hibernate.org/ 1. Hibernate Core 2. Hibernate EntityManager 3. Hibernate Annotations http://www.hibernate.org/ MySQL JDBC Driver http://tinyurl.com/ymt6rb MySQL JDBC Driver http://tinyurl.com/ymt6rb
  • 12.
  • 13.
  • 14.  Attached to a class  Signify that a class is persistent  Example:  An entity must follow the Java Bean convention for its attributes to be persistent ◦ Having getters and setters
  • 15.  Each entity must have an identity  An identity of an entity could simply be a class variable annotated with @Id  Example
  • 16.  Id can be auto generated @Id(generate=GeneratorType.AUTO)  There are other strategies such as ◦ GeneratorType.SEQUENCE ◦ GeneratorType.IDENTITY  AUTO is best for portability between database vendors
  • 17.  @Column, is put on getter of a class variable  Has several functionalities ◦ Updatable (boolean) ◦ Nullable (updatable) ◦ Length (int) ◦ Example:
  • 18.  There are 4 types of links ◦ @OneToOne ◦ @OneToMany ◦ @ManyToOne ◦ @ManyToMany  In most cases, putting the annotation on a getter of a class variable would be enough  In some cases, we need to identify a few parameters to the annotations
  • 19.  Two cases ◦ Two entities share the same primary key value
  • 20.  Entity objects have two distinct modes ◦ Attached  The object is in the database ◦ Detached  The object is in memory acting as a DTO  Modification on detached object would not be persisted automatically  Developers need to persist detached objects using a primitive
  • 21.  Entity manager: ◦ Gateway to persistent classes ◦ Enable queries ◦ Outside of session beans, provides transaction facility
  • 22. 1. Hibernate Core 2. Hibernate EntityManager 3. Hibernate Annotations http://www.hibernate.org/ 1. Hibernate Core 2. Hibernate EntityManager 3. Hibernate Annotations http://www.hibernate.org/ MySQL JDBC Driver http://tinyurl.com/ymt6rb MySQL JDBC Driver http://tinyurl.com/ymt6rb
  • 23. Entity classesEntity classes JDBC Driver JDBC Driver JDBC URL JDBC URL User nameUser name passwordpassword EntityManagerFactory Name EntityManagerFactory Name
  • 24. 1. Hibernate Core 2. Hibernate EntityManager 3. Hibernate Annotations http://www.hibernate.org/ 1. Hibernate Core 2. Hibernate EntityManager 3. Hibernate Annotations http://www.hibernate.org/ MySQL JDBC Driver http://tinyurl.com/ymt6rb MySQL JDBC Driver http://tinyurl.com/ymt6rb