Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/Examples/JPA"

m (Enterprise Application Servers)
 
(70 intermediate revisions by 14 users not shown)
Line 1: Line 1:
 
[[Category:EclipseLink/Example|JPA Examples]]
 
[[Category:EclipseLink/Example|JPA Examples]]
  
__NOTOC__
+
The following examples are provided to assist developers with their adoption and usage of EclipseLink's JPA and native ORM functionality. See the [http://www.eclipse.org/eclipselink/documentation/latest/solutions/toc.htm EclipseLink Solutions Guide] and [http://www.eclipse.org/eclipselink/documentation/latest/concepts/toc.htm Understanding EclipseLink (Concepts Guide)] for details.
 
+
The following examples are provided to assist developers with their adoption and usage of EclipseLink's JPA and native ORM functionality. See [[EclipseLink/UserGuide/Developing JPA Projects (ELUG)|Developing JPA Projects]] in the [[EclipseLink/UserGuide|EclipseLink User's Guide]] for details.
+
  
 
Source code to several of these examples, and to other examples can be found in EclipseLink's SVN repository, [http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/ here], or accessed through [[EclipseLink/Source|SVN]], or [http://www.eclipse.org/eclipselink/downloads/index.php downloads].
 
Source code to several of these examples, and to other examples can be found in EclipseLink's SVN repository, [http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/ here], or accessed through [[EclipseLink/Source|SVN]], or [http://www.eclipse.org/eclipselink/downloads/index.php downloads].
Line 14: Line 12:
 
* [[EclipseLink/Examples/JPA/EMAPI | Using the EntityManager API]]
 
* [[EclipseLink/Examples/JPA/EMAPI | Using the EntityManager API]]
 
* [[EclipseLink/Examples/JPA/Locking | How to use locking]]
 
* [[EclipseLink/Examples/JPA/Locking | How to use locking]]
* [[EclipseLink/Examples/JPA/Caching | How to use caching]]
 
* [[EclipseLink/Examples/JPA/CacheCoordination| How to enable cache coordination]] : For caching in a cluster.
 
 
* [[EclipseLink/Examples/JPA/Auditing | How to use database auditing, proxy authentication and VPD]]
 
* [[EclipseLink/Examples/JPA/Auditing | How to use database auditing, proxy authentication and VPD]]
 +
* [[EclipseLink/Examples/JPA/Partitioning | How to use load balancing, replication and data partitioning]]
 +
* [[EclipseLink/Examples/JPA/Composite | How to access multiple databases from a single composite persistence unit]]
 +
* [[EclipseLink/Examples/JPA/Performance | How to optimize performance]]
 +
 +
=== Caching ===
 +
* [[EclipseLink/Examples/JPA/Caching | How to use caching]]
 +
* [[EclipseLink/Examples/JPA/CacheCoordination| How to enable cache coordination]] : for caching in a cluster.
 +
* [[EclipseLink/Examples/JPA/DCN| How to use database event driven cache invalidation using Oracle DCN/QCN]].
  
 
=== Diagnostics ===
 
=== Diagnostics ===
Line 22: Line 26:
 
* [[EclipseLink/Examples/JPA/CustomLogger | How to configure a third party custom logger]]
 
* [[EclipseLink/Examples/JPA/CustomLogger | How to configure a third party custom logger]]
 
* [[EclipseLink/Examples/JPA/IntegrityChecker | How to validate metadata against the database]]
 
* [[EclipseLink/Examples/JPA/IntegrityChecker | How to validate metadata against the database]]
 +
* [[EclipseLink/Examples/JPA/Monitoring | How to enable performance monitoring and metrics]]
 +
 +
=== Schema ===
 +
* [[EclipseLink/Examples/JPA/DDL | How to automatically create tables and generate DDL for a persistence unit]]
 +
* [[EclipseLink/Examples/JPA/Indexes | How to create indexes]]
 +
* [[EclipseLink/Examples/JPA/DeleteCascade | How to use cascade on delete on the database]]
 +
* [[EclipseLink/Examples/JPA/Multitenant | How to use a multitenant shared schema on the database]]
  
 
=== Mapping ===
 
=== Mapping ===
Line 33: Line 44:
 
* [[EclipseLink/Examples/JPA/MappingSelectionCriteria | How to map relationships based on an expression instead of foreign keys]]
 
* [[EclipseLink/Examples/JPA/MappingSelectionCriteria | How to map relationships based on an expression instead of foreign keys]]
 
* [[EclipseLink/Examples/JPA/History | How to enable history tracking]]
 
* [[EclipseLink/Examples/JPA/History | How to enable history tracking]]
 +
* [[EclipseLink/Examples/JPA/CRUDStoredProcedures | How to use stored procedures for CRUD operations]]
 +
* [[EclipseLink/Examples/JPA/SoftDelete| How to archive records instead of deleting them (soft deletes)]]
 +
* [[EclipseLink/Examples/JPA/Extensibility| How to configure your persistence unit to be extensible at runtime]]
  
 
=== Querying ===
 
=== Querying ===
Line 39: Line 53:
 
* [[EclipseLink/Examples/JPA/DatabaseQuery | How to execute a Query using an EclipseLink native DatabaseQuery]]
 
* [[EclipseLink/Examples/JPA/DatabaseQuery | How to execute a Query using an EclipseLink native DatabaseQuery]]
 
* [[EclipseLink/Examples/JPA/QueryOptimization | How to optimize queries using batch and join fetching]]
 
* [[EclipseLink/Examples/JPA/QueryOptimization | How to optimize queries using batch and join fetching]]
* [[EclipseLink/Examples/JPA/NestedFetchGroup | How to extend EclipseLink for Nested FetchGroups (Incubator)]]
+
* [[EclipseLink/Examples/JPA/AttributeGroup | How to use FetchGroups and LoadGroups on queries, and for copying and merging]]
 +
* [[EclipseLink/Examples/JPA/StoredProcedures | How to execute a stored procedure]]
 +
* [[EclipseLink/Examples/JPA/PLSQLStoredFunction | How to execute an Oracle PLSQL stored function]]
 +
* [[EclipseLink/FAQ/JPA#How_to_get_the_SQL_for_a_Query.3F| How to get the SQL for a Query]]
  
 
=== JPA 2.0 ===
 
=== JPA 2.0 ===
 +
* [[EclipseLink/Examples/JPA/Employee|Example JPA Employee Web model]]
 
* [[EclipseLink/Examples/JPA/2.0/Employee|Example JPA 2.0 Employee model]]
 
* [[EclipseLink/Examples/JPA/2.0/Employee|Example JPA 2.0 Employee model]]
 
* [[EclipseLink/Examples/JPA/2.0/MapKeyColumns|How to use Map key columns to map complex Maps]]
 
* [[EclipseLink/Examples/JPA/2.0/MapKeyColumns|How to use Map key columns to map complex Maps]]
Line 49: Line 67:
 
* [[EclipseLink/Examples/JPA/2.0/OrderColumns|How to maintain order in a List relationship using an OrderColumn]]
 
* [[EclipseLink/Examples/JPA/2.0/OrderColumns|How to maintain order in a List relationship using an OrderColumn]]
 
* [[EclipseLink/Examples/JPA/2.0/Criteria|How to define dynamic queries using the JPA 2.0 Criteria API]]
 
* [[EclipseLink/Examples/JPA/2.0/Criteria|How to define dynamic queries using the JPA 2.0 Criteria API]]
 +
 +
=== JPA 2.1 ===
 +
* [[EclipseLink/Release/2.5/JPA21#Bulk_Update|Bulk Update]]
 +
* [[EclipseLink/Release/2.5/JPA21#Stored_Procedures|Stored Procedures]]
 +
* [[EclipseLink/Release/2.5/JPA21#JPQL_function|JPQL function]]
 +
* [[EclipseLink/Release/2.5/JPA21#CDI_Entity_Listeners|CDI Entity Listeners]]
 +
* [[EclipseLink/Release/2.5/JPA21#Treat|Treat]]
 +
* [[EclipseLink/Release/2.5/JPA21#Converters|Converters]]
 +
* [[EclipseLink/Release/2.5/JPA21#DDL generation|DDL generation]]
 +
* [[EclipseLink/Release/2.5/JPA21#Add Named Query|Add Named Query]]
 +
* [[EclipseLink/Release/2.5/JPA21#Entity Graphs|Entity Graphs]]
 +
* [[EclipseLink/Release/2.5/JPA21#Unsynchronized Persistence Contexts|Unsynchronized Persistence Contexts]]
 +
 +
=== JPA-RS ===
 +
 +
* [[EclipseLink/Examples/JPARS/Simple | Simple Student Example]]
 +
* [[EclipseLink/Examples/JPARS/JavaScriptClient | JavaScript Web Client]]
 +
* [[EclipseLink/Examples/JPARS/HelloDynamic | Hello World - Dynamic]]
 +
* [[EclipseLink/Development/2.4.0/JPA-RS/Security | Securing JPA-RS in GlassFish]]
 +
 +
=== NoSQL ===
 +
* [[EclipseLink/Examples/JPA/NoSQL| How to access NoSQL databases such as MongoDB]]
 +
* [[EclipseLink/Examples/PolyglotPersistence | Polyglot Persistence (Relational and NoSQL)]]
  
 
=== Java SE Examples ===
 
=== Java SE Examples ===
Line 74: Line 115:
 
== Tutorials ==   
 
== Tutorials ==   
 
===Application Server Tutorials===
 
===Application Server Tutorials===
 +
*The following tutorials are for enterprise developers interested in container or application managed persistence using the JPA 1.0 or 2.0 API.
 +
*See the [http://wiki.eclipse.org/EclipseLink/Examples/Distributed Distributed JPA Application] case study on how a '''Service/Workers''' parallel pattern based application uses JPA to deal with Optimistic lock exception scenarios using Java EE 6 API elements - specifically as a single persistence unit used by the distributed application as an alternative to using a shared L2 cache.
 
====Enterprise Application Servers====
 
====Enterprise Application Servers====
* [http://java.sun.com/javaee/overview/compatibility.jsp JEE5 Compliant Application Servers]
+
* [http://java.sun.com/javaee/overview/compatibility.jsp Java EE 5 Compliant Application Servers]
* Step by step instructions by container for a quick-start JEE [http://wiki.eclipse.org/Introduction_to_EclipseLink_Application_Development_%28ELUG%29#Considering_JPA_Entity_Architecture EclipseLink JPA container-managed Application] using a [http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.common.ddlgen single JPA Entity] on the major subset of [http://en.wikipedia.org/wiki/Matrix_of_Application_Servers all application servers]
+
* Step by step instructions by container for a quick-start Java EE [http://wiki.eclipse.org/Introduction_to_EclipseLink_Application_Development_%28ELUG%29#Considering_JPA_Entity_Architecture EclipseLink JPA container-managed Application] using a [http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.common.ddlgen single JPA Entity] on the major subset of [http://en.wikipedia.org/wiki/Matrix_of_Application_Servers all application servers]
 
* We use a standard container managed @PersistenceContext(..TransactionType dependency injected EntityManager) that is injected on a @Stateless session bean so that the container can provide a thread safe proxy wrapper around the @NotThreadSafe EntityManager and provide us with instrumented transaction management and change tracking.  The client servlet gets injected with the @EJB SSB by the web container and is completely separated from the JPA persistence concern.
 
* We use a standard container managed @PersistenceContext(..TransactionType dependency injected EntityManager) that is injected on a @Stateless session bean so that the container can provide a thread safe proxy wrapper around the @NotThreadSafe EntityManager and provide us with instrumented transaction management and change tracking.  The client servlet gets injected with the @EJB SSB by the web container and is completely separated from the JPA persistence concern.
 
* <font color="orange">These tutorials need to be finished and/or expanded - vote for EclipseLink bug# '''[http://bugs.eclipse.org/308477 308477]''' if you would like this work to be fast tracked.</font>
 
* <font color="orange">These tutorials need to be finished and/or expanded - vote for EclipseLink bug# '''[http://bugs.eclipse.org/308477 308477]''' if you would like this work to be fast tracked.</font>
Line 83: Line 126:
 
! Container
 
! Container
 
! Version
 
! Version
! JEE Spec.
+
! Java EE Spec.
 
! Source  
 
! Source  
  
Line 91: Line 134:
 
! Issues
 
! Issues
 
|-
 
|-
|[[EclipseLink/Examples/JPA/WebLogic_Web_Tutorial|Oracle WebLogic Server]]|| [http://www.oracle.com/technology/software/products/ias/htdocs/wls_main.html?rssid=rss_otn_soft 10.3.3.0 / 11gR1] || 5 + (JPA 2.0) ||
+
|[[EclipseLink/Examples/JPA/WebLogic_Web_Tutorial|Oracle WebLogic Server]]|| [http://www.oracle.com/technetwork/middleware/weblogic/downloads/index.html  10.3.6.0 / 12c] || 5 + (JPA 2.0, JSF 2, JAX-RS 1.1) ||
 
[http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.weblogic.enterpriseEAR EAR][http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.weblogic.enterpriseEJB EJB][http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.weblogic.enterpriseWeb WAR]
 
[http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.weblogic.enterpriseEAR EAR][http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.weblogic.enterpriseEJB EJB][http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.weblogic.enterpriseWeb WAR]
 
||
 
||
 
[[EclipseLink/Examples/JPA/WLS_AppScoped_DataSource| - See application-scoped datasource workaround]].
 
[[EclipseLink/Examples/JPA/WLS_AppScoped_DataSource| - See application-scoped datasource workaround]].
  
- TODO 20081011: Verify weaving works in container and application managed EM modes (the current data model only uses @OneToOne and @ManyToMany)
+
- TODO 20100115: Update for WebLogic 10.3.6 and JPA 2.0 - Verify weaving works in container and application managed EM modes (the current data model only uses @OneToOne and @ManyToMany)
 +
 
 +
[http://www.oracle.com/technetwork/developer-tools/eclipse/overview/tutorials-101794.html Oracle WebLogic Tutorials]
 
|-
 
|-
 
|[[EclipseLink/Examples/JPA/OC4J_Web_Tutorial|Oracle OC4J]]|| 10.1.3.5 || 1.4 (with EJB 3.0) ||
 
|[[EclipseLink/Examples/JPA/OC4J_Web_Tutorial|Oracle OC4J]]|| 10.1.3.5 || 1.4 (with EJB 3.0) ||
Line 141: Line 186:
 
|-
 
|-
 
|[[EclipseLink/Examples/JPA/Jeus_Web_Tutorial|TMAX Jues]] || 6 || 5 ||  
 
|[[EclipseLink/Examples/JPA/Jeus_Web_Tutorial|TMAX Jues]] || 6 || 5 ||  
  || - [http://bugs.eclipse.org/331717 331717]  
+
  || - [http://bugs.eclipse.org/331717 331717 - A wrapper around GlassFish server]  
 
|}
 
|}
  
 
====Lightweight Application Servers====
 
====Lightweight Application Servers====
 +
* [[EclipseLink/Examples/JPA/JSF_Tutorial|Tutorial: Build a Web Application (JSF) Using JPA on Tomcat]]
 +
 
{|{{BMTableStyle}}
 
{|{{BMTableStyle}}
 
|-{{BMTHStyle}}
 
|-{{BMTHStyle}}
 
! Container
 
! Container
 
! Version
 
! Version
! JEE Spec.
+
! Java EE Spec.
 
! Source  
 
! Source  
  
Line 174: Line 221:
 
|[[EclipseLink/Examples/JPA/Jetty_Web_Tutorial|Jetty]] || 7 || ? || - || - [http://www.eclipse.org/jetty/ Jetty] is a web-only container ([http://download.eclipse.org/jetty/stable-7/xref/ source]) ([http://download.eclipse.org/jetty/stable-7/dist/ binary]) that can be targetted the same way we target Tomcat (''NoServerPlatform'')
 
|[[EclipseLink/Examples/JPA/Jetty_Web_Tutorial|Jetty]] || 7 || ? || - || - [http://www.eclipse.org/jetty/ Jetty] is a web-only container ([http://download.eclipse.org/jetty/stable-7/xref/ source]) ([http://download.eclipse.org/jetty/stable-7/dist/ binary]) that can be targetted the same way we target Tomcat (''NoServerPlatform'')
 
|-
 
|-
|[[EclipseLink/Examples/JPA/Tomcat_Web_Tutorial|Apache Tomcat]] || 6.0.18 || 5 (w/o EJB) || [https://bugs.eclipse.org/250476 250476] || - 2.5 Servlet container will support application managed JPA entities using RESOURCE_LOCAL or JTA transactions.
+
|[[EclipseLink/Examples/JPA/Tomcat_Web_Tutorial|Apache Tomcat]] || 6.0.29 || 5 (w/o EJB) || [https://bugs.eclipse.org/250476 250476] || - 2.5 Servlet container will support application managed JPA entities using RESOURCE_LOCAL or JTA transactions.
  
 
- JTA datasource (without JTATransactionController) available when running as Tomcat service
 
- JTA datasource (without JTATransactionController) available when running as Tomcat service
Line 183: Line 230:
  
 
- No @EJB or @PersistenceContext injection is available.
 
- No @EJB or @PersistenceContext injection is available.
 +
 +
- [http://netbeans.org/community/releases/70/ Apache Tomcat 7.0.6 is bundled with NetBeans 7.0]
 +
- 20110524: added JSF 2.0 configuration on Tomcat section
 
|}
 
|}
  
Line 206: Line 256:
  
 
====EclipseLink JPA Examples Matrix by Container ====
 
====EclipseLink JPA Examples Matrix by Container ====
*The following grid cross-references the above JPA JEE Tutorials by Application server, Database and type of presentation framework - to answer the question "How to run EclipseLink JPA on an application server against a particular database"?
+
*The following grid cross-references the above JPA Java EE Tutorials by Application server, Database and type of presentation framework - to answer the question "How to run EclipseLink JPA on an application server against a particular database"?
  
 
{|{{BMTableStyle}}
 
{|{{BMTableStyle}}
Line 218: Line 268:
 
! <font color="blue">DB2 Ex</font>
 
! <font color="blue">DB2 Ex</font>
 
|-
 
|-
|'''WebLogic''' ||[[EclipseLink/Examples/JPA/WebLogic_Web_Tutorial|Servlet]]|| ||[[EclipseLink/Examples/JPA/WebLogic_Web_Tutorial|Servlet]] || || ||  
+
|'''WebLogic''' ||[[EclipseLink/Examples/JPA/WebLogic_Web_Tutorial|Servlet]]|| ||[[EclipseLink/Examples/JPA/WebLogic_Web_Tutorial|Servlet]]
 +
 
 +
[[EclipseLink/Examples/Distributed|JSF 2.0]]
 +
|| || ||  
 
|-
 
|-
 
|'''OC4J''' ||[[EclipseLink/Examples/JPA/OC4J_Web_Tutorial|Servlet]]|| || || || ||
 
|'''OC4J''' ||[[EclipseLink/Examples/JPA/OC4J_Web_Tutorial|Servlet]]|| || || || ||
Line 240: Line 293:
 
<table border="0" cellpadding="5" align="center"><tr><td width="20">[[image:Catnicon.gif]]</td><td>This section contains Examples and tutorials that are not yet complete.</td></tr></table>
 
<table border="0" cellpadding="5" align="center"><tr><td width="20">[[image:Catnicon.gif]]</td><td>This section contains Examples and tutorials that are not yet complete.</td></tr></table>
 
</div>
 
</div>
 
  
 
=== Querying ===
 
=== Querying ===
Line 254: Line 306:
 
=== Advanced ===
 
=== Advanced ===
 
* [[EclipseLink/Examples/JPA/Dynamic | Dynamic JPA Example]] : Example extension for JPA without Java classes and XML
 
* [[EclipseLink/Examples/JPA/Dynamic | Dynamic JPA Example]] : Example extension for JPA without Java classes and XML
 
+
* [[EclipseLink/Examples/JPA/Extensible | ExtensibleJPA Example]] : Example showing extensible Entity Types (EclipseLink 2.2)
=== Application Server specific ===
+
* [[EclipseLink/Examples/JPA/JSF_Tutorial|Tutorial: Build a Web Application (JSF) Using JPA on Tomcat - deprecated]]
+
  
 
=== Using EclipseLink JPA with SEAM ===
 
=== Using EclipseLink JPA with SEAM ===
Line 264: Line 314:
 
The following tutorials describe details on running EclipseLink JPA on a specific Java IDE.
 
The following tutorials describe details on running EclipseLink JPA on a specific Java IDE.
  
* [[EclipseLink/Examples/JPA#JPA_Web_Application_Tutorials|Eclipse 3.6]]
+
* [[EclipseLink/Examples/JPA#JPA_Web_Application_Tutorials|Eclipse 3.6 Helios EE]]
 
* [[EclipseLink/Examples/JPA/IDE/SpringSourceToolSuite|SpringSource Tool Suite 2.3.0]]
 
* [[EclipseLink/Examples/JPA/IDE/SpringSourceToolSuite|SpringSource Tool Suite 2.3.0]]
* [[EclipseLink/Examples/JPA/IDE/NetBeans|SUN NetBeans 6.8 M1]]
+
* [[EclipseLink/Examples/JPA/IDE/NetBeans|SUN NetBeans 7.0 Beta 2]]
 
* [[EclipseLink/Examples/JPA/IDE/JDeveloper|Oracle JDeveloper 11.1.2]]
 
* [[EclipseLink/Examples/JPA/IDE/JDeveloper|Oracle JDeveloper 11.1.2]]
* [[EclipseLink/Examples/JPA/IDE/MyEclipse|MyEclipse]]
+
<!--* [[EclipseLink/Examples/JPA/IDE/MyEclipse|MyEclipse]]-->
 
* WebLogic Workshop
 
* WebLogic Workshop
 
* IBM WebSphere Studio
 
* IBM WebSphere Studio
Line 274: Line 324:
 
* [http://www.jetbrains.com/idea/ IntelliJ IDEA 10] (community and commercial)
 
* [http://www.jetbrains.com/idea/ IntelliJ IDEA 10] (community and commercial)
 
* Borland JBuilder
 
* Borland JBuilder
 
 
<!--=== Integrating EclipseLink JPA with Network Attached Memory===
 
<!--=== Integrating EclipseLink JPA with Network Attached Memory===
 
*[[EclipseLink/Examples/JPA/EhCache|EhCache]]-->
 
*[[EclipseLink/Examples/JPA/EhCache|EhCache]]-->
Line 288: Line 337:
 
* [[EclipseLink/Examples/JPA/JBoss_Web_Tutorial|HSQL]] on [[EclipseLink/Examples/JPA/Migration/JBoss|JBoss]]
 
* [[EclipseLink/Examples/JPA/JBoss_Web_Tutorial|HSQL]] on [[EclipseLink/Examples/JPA/Migration/JBoss|JBoss]]
 
* [https://www.sdn.sap.com/downloads/maxdb/7_7/maxdb-all-win-64bit-x86_64-7_7_07_16.exe SAP MaxDB 7.7.07.16 for Windows (x86_64, 64 bit)] [http://www.sdn.sap.com/irj/sdn/softwaredownload?download=https://www.sdn.sap.com/downloads/maxdb/7_7/maxdb-all-win-32bit-i386-7_7_07_16.exe 32-bit] :[http://wiki.sdn.sap.com/wiki/display/MaxDB/SAP%20MaxDB wiki] : [http://forums.sdn.sap.com/forum.jspa?forumID=90 forum]
 
* [https://www.sdn.sap.com/downloads/maxdb/7_7/maxdb-all-win-64bit-x86_64-7_7_07_16.exe SAP MaxDB 7.7.07.16 for Windows (x86_64, 64 bit)] [http://www.sdn.sap.com/irj/sdn/softwaredownload?download=https://www.sdn.sap.com/downloads/maxdb/7_7/maxdb-all-win-32bit-i386-7_7_07_16.exe 32-bit] :[http://wiki.sdn.sap.com/wiki/display/MaxDB/SAP%20MaxDB wiki] : [http://forums.sdn.sap.com/forum.jspa?forumID=90 forum]
 
+
* [[EclipseLink/Examples/JPA/SyBase|JPA on Sybase]]
 +
* [[EclipseLink/Examples/JPA/WebLogic_Web_Tutorial#Install_postgreSQL_in_WebLogic_12.1.2|JPA on postgeSQL 9.3 on WebLogic 12.1.2.1 (OSX 10.9 64 bit)]]
 
<!--=== Integrating EclipseLink JPA with a [http://www.oracle.com/us/corporate/software-hardware-complete-069519.html Hardware] Platform ===
 
<!--=== Integrating EclipseLink JPA with a [http://www.oracle.com/us/corporate/software-hardware-complete-069519.html Hardware] Platform ===
 
This section describes options for '''''architecture aware''''' development where details of the underlying hardware may be significant enough to reach the persistence layer.
 
This section describes options for '''''architecture aware''''' development where details of the underlying hardware may be significant enough to reach the persistence layer.
Line 294: Line 344:
 
* [[EclipseLink/Examples/J2ME|Java 2 Micro Edition page]]: [http://www.oracle.com/technetwork/java/javame/overview/index.html J2ME] virtual machines such as the '''[http://na.blackberry.com/eng/developers/javaappdev/ RIM]''' smartphone or the '''[http://java.sun.com/products/cldc/wp/ SUN K VM]''' running the Connected Limited Device Configuration (CLDC) API ([http://java.sun.com/products/cldc/index.jsp JSR 139]) version 1.1, the Mobile Information Device Profile (MIDP) version 2.0, the Mobile Sensor API ([http://jcp.org/en/jsr/detail?id=256 JSR 256]), the Contactless Communication API ([http://jcp.org/en/jsr/detail?id=257 JSR 257]) or J2ME Web Services API ([http://jcp.org/en/jsr/detail?id=172 JSR 172]) API.
 
* [[EclipseLink/Examples/J2ME|Java 2 Micro Edition page]]: [http://www.oracle.com/technetwork/java/javame/overview/index.html J2ME] virtual machines such as the '''[http://na.blackberry.com/eng/developers/javaappdev/ RIM]''' smartphone or the '''[http://java.sun.com/products/cldc/wp/ SUN K VM]''' running the Connected Limited Device Configuration (CLDC) API ([http://java.sun.com/products/cldc/index.jsp JSR 139]) version 1.1, the Mobile Information Device Profile (MIDP) version 2.0, the Mobile Sensor API ([http://jcp.org/en/jsr/detail?id=256 JSR 256]), the Contactless Communication API ([http://jcp.org/en/jsr/detail?id=257 JSR 257]) or J2ME Web Services API ([http://jcp.org/en/jsr/detail?id=172 JSR 172]) API.
 
-->
 
-->
 +
 +
==References==
 +
* Maven update site for eclipse [http://download.eclipse.org/technology/m2e/releases http://download.eclipse.org/technology/m2e/releases]

Latest revision as of 04:03, 6 May 2015


The following examples are provided to assist developers with their adoption and usage of EclipseLink's JPA and native ORM functionality. See the EclipseLink Solutions Guide and Understanding EclipseLink (Concepts Guide) for details.

Source code to several of these examples, and to other examples can be found in EclipseLink's SVN repository, here, or accessed through SVN, or downloads.

EclipseLink JPA Examples/Tutorials

General

Caching

Diagnostics

Schema

Mapping

Querying

JPA 2.0

JPA 2.1

JPA-RS

NoSQL

Java SE Examples

Rich Client Platform (RCP)

Spring JPA

Using Native ORM through JPA

Using Native EclipseLink ORM API

Migration

Tutorials

Application Server Tutorials

  • The following tutorials are for enterprise developers interested in container or application managed persistence using the JPA 1.0 or 2.0 API.
  • See the Distributed JPA Application case study on how a Service/Workers parallel pattern based application uses JPA to deal with Optimistic lock exception scenarios using Java EE 6 API elements - specifically as a single persistence unit used by the distributed application as an alternative to using a shared L2 cache.

Enterprise Application Servers

  • Java EE 5 Compliant Application Servers
  • Step by step instructions by container for a quick-start Java EE EclipseLink JPA container-managed Application using a single JPA Entity on the major subset of all application servers
  • We use a standard container managed @PersistenceContext(..TransactionType dependency injected EntityManager) that is injected on a @Stateless session bean so that the container can provide a thread safe proxy wrapper around the @NotThreadSafe EntityManager and provide us with instrumented transaction management and change tracking. The client servlet gets injected with the @EJB SSB by the web container and is completely separated from the JPA persistence concern.
  • These tutorials need to be finished and/or expanded - vote for EclipseLink bug# 308477 if you would like this work to be fast tracked.
Container Version Java EE Spec. Source

DDL-gen JPA Entities JAR

Issues
Oracle WebLogic Server 10.3.6.0 / 12c 5 + (JPA 2.0, JSF 2, JAX-RS 1.1)

EAREJBWAR

- See application-scoped datasource workaround.

- TODO 20100115: Update for WebLogic 10.3.6 and JPA 2.0 - Verify weaving works in container and application managed EM modes (the current data model only uses @OneToOne and @ManyToMany)

Oracle WebLogic Tutorials

Oracle OC4J 10.1.3.5 1.4 (with EJB 3.0)

EAREJBWAR

- Updated for version 10.1.3.5
GlassFish V3 6 - - Use V3 prelude - not TP2

- Use the 1.0.9+ snapshot plugin (with fixed library references) against a prelude server - currently at b73 which runs EclipseLink 2.0 with JPA 2.0 support out of the box

GlassFish V2.1.1 5 - - Requires GlassFish V2.1 build 32

- Current Production Release

- migrating from TopLink Essentials to EclipseLink

SUN Application Server 9.1 5 - - See GlassFish V2 which is included in Sun AS 9
SAP NetWeaver Application Server 7.2 5
JBoss 6.0.0M1 6

EAREJBWAR

- Updated for JBoss 6.0.0M1

- Dynamic weaving is disabled due to (JIRA-572)

- see static weaving workaround using the JBoss JSFEJB3 example

TODO: >rework tutorial for JBoss 6.0.0 M1

IBM WebSphere 7.0.0.5 5 309201 CM EAR

- Updated for Container Managed and Application Managed scenarios as of 20100419

- There is no WAS 7.0 Eclipse WTP Server plugin yet - you can attach the Eclipse IDE to a WebSphere 7 server in debug mode on port 7777

IBM WebSphere 6.1.0.0 1.4/5 - - Supports JPA1/EJB3 with optional feature pack on Java SE 1.5

- The WAS 6.1 Eclipse WTP Server plugin (ehr 160221) should be in the next release of Ganymede 3.4 in Dec08 - or use manual or python deployment

TMAX Jues 6 5 - 331717 - A wrapper around GlassFish server

Lightweight Application Servers

Container Version Java EE Spec. Source

DDL-gen JPA Entities JAR

Issues

Eclipse Virgo (was SpringSource dm)

2.1 6 (WAR only) - Virgo is an OSGI enabled web container based on the recently contributed VMWare Springsource dm server and the Gemini OSGI web container (which was aimed at Springsource OSGI users.
SpringSource tc 6.0.20 5 (WAR only) - - see STS 2.3.0 as in TomCat server based
IBM WebSphere CE 2.1.0.1 5 - - WebSphere CE 2.1 is only certified on Java SE 1.5 (SUN JRE 1.6 runtime support is available)
Apache Geronimo 2.0.2 5 - - see WebSphere CE which wraps Geronimo, Derby and OpenJPA
Jetty 7  ? - - Jetty is a web-only container (source) (binary) that can be targetted the same way we target Tomcat (NoServerPlatform)
Apache Tomcat 6.0.29 5 (w/o EJB) 250476 - 2.5 Servlet container will support application managed JPA entities using RESOURCE_LOCAL or JTA transactions.

- JTA datasource (without JTATransactionController) available when running as Tomcat service

- SessionCustomizer is required for non-JTA and JTA datasource access.

- Only static weaving (instrumentation) is available.

- No @EJB or @PersistenceContext injection is available.

- Apache Tomcat 7.0.6 is bundled with NetBeans 7.0 - 20110524: added JSF 2.0 configuration on Tomcat section


EclipseLink JPA Examples Matrix by Container

  • The following grid cross-references the above JPA Java EE Tutorials by Application server, Database and type of presentation framework - to answer the question "How to run EclipseLink JPA on an application server against a particular database"?
Database --> Oracle MySQL Derby JavaDB HSQL DB2 Ex
WebLogic Servlet Servlet

JSF 2.0

OC4J Servlet
Glassfish Servlet
Sun AS Servlet
JBoss Servlet or JSF
IBM WebSphere 7 Servlet
Geronimo
Tomcat Servlet

Under Construction

Catnicon.gifThis section contains Examples and tutorials that are not yet complete.

Querying

Java SE Examples

Database Platform Extensions

  • Oracle: Spatial, VPD/OLS, TIMESTAMP, XDB

Advanced

Using EclipseLink JPA with SEAM

Integrating EclipseLink JPA with an IDE

The following tutorials describe details on running EclipseLink JPA on a specific Java IDE.

Integrating EclipseLink JPA with a Database Platform

The following tutorials describe details on running EclipseLink JPA on a specific database platform.

References

Back to the top