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/Migration/OpenJPA/Extended"

< EclipseLink‎ | Examples‎ | JPA‎ | Migration‎ | OpenJPA
(New page: == Migration from OpenJPA to EclipseLink JPA: Extended Functionality == '' Note: Under Construction'' OpenJPA does offers some extended functionality that goes beyond the JPA specificati...)
 
m
 
Line 5: Line 5:
 
OpenJPA does offers some extended functionality that goes beyond the JPA specification the following sections describe these features and how you migrate to the corresponding functionality in EclipseLink. If there are additional features not covered in this page or the materials provided are incomplete for your needs please log a [https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EclipseLink&bug_severity=enhancement documentation enhancement request] referencing this page describing the migration challenge.
 
OpenJPA does offers some extended functionality that goes beyond the JPA specification the following sections describe these features and how you migrate to the corresponding functionality in EclipseLink. If there are additional features not covered in this page or the materials provided are incomplete for your needs please log a [https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EclipseLink&bug_severity=enhancement documentation enhancement request] referencing this page describing the migration challenge.
  
* BigCollection  
+
* '''BigCollection'''
* FetchPlan/Group
+
* '''FetchPlan/Group'''
* Inheritance Casting
+
* '''Inheritance Casting'''
* Native SQL with POJO results
+
* '''Native SQL with POJO results'''
* Detached (Serialized) entities & relationships
+
* '''Detached (Serialized) entities & relationships'''
 +
* '''PersistentCollection:''' When the OpenJPA specific @org.apache.openjpa.persistence.PersistentCollection annotation is used with an array of objects field type, a new table is created for this field. Simply removing the @PersistentCollection annotation without a replacement will result in this new table not being created.
 +
<ul><ul>
 +
<li> In order to continue using the existing table created for the array of objects field, the following adjustments to the entity class can be made:
 +
<ol>
 +
<li> Replace the @org.apache.openjpa.persistence.PersistentCollection annotation with @javax.persistence.ElementCollection and @Column(name="ELEMENT") </li>
 +
<li> Change the array to be a collection of objects.
 +
<br>Example:
 +
{|{{BMTableStyle}}
 +
|-{{BMTHStyle}}
 +
! Before
 +
! After
 +
|-
 +
|
 +
<source lang="java">
 +
@PersistentCollection
 +
private int[] arrayOfInts;
 +
</source>
 +
||
 +
<source lang="java">
 +
@ElementCollection
 +
@Column(name="ELEMENT")
 +
private List<Integer> arrayOfInts;
 +
</source>
 +
|}
 +
</li>
 +
</ol>
 +
</li>
 +
</ul></ul>

Latest revision as of 12:10, 12 November 2014

Migration from OpenJPA to EclipseLink JPA: Extended Functionality

Note: Under Construction

OpenJPA does offers some extended functionality that goes beyond the JPA specification the following sections describe these features and how you migrate to the corresponding functionality in EclipseLink. If there are additional features not covered in this page or the materials provided are incomplete for your needs please log a documentation enhancement request referencing this page describing the migration challenge.

  • BigCollection
  • FetchPlan/Group
  • Inheritance Casting
  • Native SQL with POJO results
  • Detached (Serialized) entities & relationships
  • PersistentCollection: When the OpenJPA specific @org.apache.openjpa.persistence.PersistentCollection annotation is used with an array of objects field type, a new table is created for this field. Simply removing the @PersistentCollection annotation without a replacement will result in this new table not being created.
    • In order to continue using the existing table created for the array of objects field, the following adjustments to the entity class can be made:
      1. Replace the @org.apache.openjpa.persistence.PersistentCollection annotation with @javax.persistence.ElementCollection and @Column(name="ELEMENT")
      2. Change the array to be a collection of objects.
        Example:
        Before After
        @PersistentCollection
        private int[] arrayOfInts;
        @ElementCollection
        @Column(name="ELEMENT")
        private List<Integer> arrayOfInts;

Back to the top