1 / 9

Introduction to JPA

Introduction to JPA. Java Persistence API. ORM Object-Relational Mapping. Problem Object oriented programming languages Relational DBMS Several ORM frameworks has tried to ”fix” the problem Example: Hibernate JPA standardizes O/R mapping. Impedance mismatch EJB 3 In Action, page 252.

kelii
Download Presentation

Introduction to JPA

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to JPA Java Persistence API Introduction to JPA

  2. ORMObject-Relational Mapping • Problem • Object oriented programming languages • Relational DBMS • Several ORM frameworks has tried to ”fix” the problem • Example: Hibernate • JPA standardizes O/R mapping Introduction to JPA

  3. Impedance mismatchEJB 3 In Action, page 252 Introduction to JPA

  4. Java EE 5 • JPA is part of Java EE 5 • JPA works between the Business Tier and the EIS tier (Enterprise Information System) • Figure from ”Java EE 5 Tutorial” • http://java.sun.com/javaee/5/docs/tutorial/doc/bnaay.html Introduction to JPA

  5. Java EE 5 • Some Java EE 5 containers • GlassFish from Sun • Application Server from Oracle • JBoss • WebSphere from IBM • WebLogic from BEA • BEA was recently acquired by Oracle • Apache Tomcat • Not a full Java EE container, only a web container Introduction to JPA

  6. Java Persistence API • JPA is an API • Implemented by a persistence provider • Like JDBC is an API implemented by • Some persistence providers • Hibernate from JBoss • TopLink from Oracle • Kodo from BEA • recently acquired by Oracle Introduction to JPA

  7. The class EntityManager • EntityManager is the most important class of JPA • Full name javax.persistence.EntityManager • Some methods of EntityManager • T find(primaryKey) • Query createQuery(String jpql) • Creates a JPQL query • Query createNativeQuery(String sql) • Creates a SQL query • Some methods of Query • List getResultList() • Executes a Query and returns a list of objects Introduction to JPA

  8. Java Persistence Query Language (JPQL) • Very much like ordinary SQL • But not specific to any DBMS • JPA converts JPQL to ordinary SQL for the actual DBMS Introduction to JPA

  9. EJB 3 • EJB 3 • Enterprise Java Beans • Important part of Java EE 5 • Much simpler than EJB 2 • POJO + annotations • Plain Old Java Objects • EJB classes can • Create database tables or • Be created from database tables Introduction to JPA

More Related