Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-dev] JPA Entity Manager Backup Clone Problem By Using SDO

Hi EclipseLink Team, 
In our SDO service project we some problems to use JPA with SDO class mapping.
Using SDO classes to retrieve database data by JPA causes wrong values for related objects (mapped by ONE-TO-ONE or ONE-TO-MANY).
We have created an example eclipse project 'AddressBook-JPA-SDO' to simulate / demonstrate the problem / fault.
There are three entities: Person, Address and Phone. The Person entity contains the attribute address (Address.class mapped by one-to-one).
The Phone entity is related to Person as the attribute phoneList (Phone.class mapped by one-to-many). All entity classes are implemented as SDODataObject.
When we try to read the data by the root entity Person, the related Address object is retuned by null (finally). Also the Phone list object is corrupted. The list contains the same amount of objects like they are stored in the database, but the their class type isn't correct. The contend of the Phone list is set to the type Person.
By debugging the EclipseLink data load process, we recognized that all backup cloning for one-to-one and one-to-many related attributes retuning the clone object of the working copy (previous clone). This is designed the method buildBackupCloneForPartObject() in the classes org.eclipse.persistence.mappings.ObjectReferenceMapping. 
If we set the Person descriptor to read-_only_=true, the backup clone will not be created and the data of Person, Address and Phone (list) will be returned/loaded correctly.
But this prevents update and create processing of the Person, Address and Phone by the entity manager.
If we use POJOs everything works fine (see project 'AddressBook-Session-XML'. But we have to implement SDO objects on our service project and won't design a special layer / process to merge POJO data with SDO data.
Do You have an idea / suggestion to solve this problem? 
Do You think SDO object persistency problem just a fixable issue or there are some fundamental design challenges?
Kind regards,
Andrei Shakirin, Robert Lalyko
p.s: the attachment contents :
    - AddressBook(Derby-Database).zip   // Apache Derby Database 10.2.4 contains test data of Person, Address, Phone
    - AddressBook(JPA-Session-XML).zip // Eclipse JPA Project using POJOs (EclipseLink project.xml mapping)
    - AddressBook(JPA-SDO).zip // Eclipse JPA Project using SDO (EclipseLink project.xml mapping) 
    - Eclipse Ganymede (3.4) (incl. Dali)
    - EclipseLink 1.1-SNAPSHOT (2009-01-09)


Back to the top