problem when persist object using JOINED inhertitance under 1.1.0

This is a discussion on problem when persist object using JOINED inhertitance under 1.1.0 within the Apache forums in Application Servers & Tools category; It looks like I have run into something similar. I ran my test multiple times with 3 distinct results. Please see the attachment. My observation is that : Sometimes 1. Insert attempt is made in the Child table before the parent. 2. Insert attempt is made in the Secondary table before the primary. 3. The happy path. The Model: @Entity @Table(name = "PARTY") @DiscriminatorColumn(name = "PARTY_CLASS_CD") @SecondaryTable(name = "PARTY_TYPE_INSTANCE", pkJoinColumns = @PrimaryKeyJoinColumn(name = "PARTY_ID", referencedColumnName = "PARTY_ID")) @Inheritance(strategy = InheritanceType.JOINED) public class Customer extends AuditInfo {...} @Entity @DiscriminatorValue("PER") @Table(name = "PERSON") @PrimaryKeyJoinColumn(name = "PARTY_ID", referencedColumnName = "PARTY_ID") public class Person ...

Go Back   Application Development Forum > Application Servers & Tools > Apache

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #11  
Old 08-28-2008, 03:41 PM
atilla
Guest
 
Default Re: InheritanceType.Joined does not work


It looks like I have run into something similar. I ran my test multiple times
with 3 distinct results. Please see the attachment. My observation is that :
Sometimes

1. Insert attempt is made in the Child table before the parent.
2. Insert attempt is made in the Secondary table before the primary.
3. The happy path.

The Model:

@Entity
@Table(name = "PARTY")
@DiscriminatorColumn(name = "PARTY_CLASS_CD")
@SecondaryTable(name = "PARTY_TYPE_INSTANCE", pkJoinColumns =
@PrimaryKeyJoinColumn(name = "PARTY_ID", referencedColumnName = "PARTY_ID"))
@Inheritance(strategy = InheritanceType.JOINED)
public class Customer extends AuditInfo {...}

@Entity
@DiscriminatorValue("PER")
@Table(name = "PERSON")
@PrimaryKeyJoinColumn(name = "PARTY_ID", referencedColumnName = "PARTY_ID")
public class Person extends Customer {...}

Client Code:

EntityManager em = emf.createEntityManager();
EntityTransaction tx = em.getTransaction();
tx.begin();

Person org = new Person();
...
...

em.persist((Customer) per);

tx.commit();
em.close();

http://n2.nabble.com/file/n790496/log.txt log.txt






Pinaki Poddar wrote:
>
> Hi,
> Please post a reproducible JUnit (not DBUnit) test with all required
> artifacts (entities, mapping annotations/descriptors, persistence.xml)
> with assertions to demonstrate the exact nature of failure.
>
> Then we can confirm whether the reported observation is a OpenJPA
> limitation/bug or not.
>
>


--
View this message in context: http://n2.nabble.com/problem-when-pe...91p790496.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Reply With Quote
  #12  
Old 09-04-2008, 01:17 AM
atilla
Guest
 
Default Re: InheritanceType.Joined does not work


I have attached the Schema, Java Sources and the build file. (libraries are
not included)

Source files: OpenJPAIssue\jpa\src
XML/Properties: OpenJPAIssue\jpa\etc
Database Schema: OpenJPAIssue\schema.sql
Client: OpenJPAIssue\jpa\src\client\JPAHelloWorld
Ant Log File: OpenJPAIssue\ant_log.txt (this will have details of the
execution environment)

The build scripts "run" target invokes the client. When I run it a few times
in succession, I find that it fails and succeeds as described in my earlier
post.

http://n2.nabble.com/file/n838052/OpenJPAIssue.zip OpenJPAIssue.zip




Pinaki Poddar wrote:
>
> Hi,
> Please post a reproducible JUnit (not DBUnit) test with all required
> artifacts (entities, mapping annotations/descriptors, persistence.xml)
> with assertions to demonstrate the exact nature of failure.
>
> Then we can confirm whether the reported observation is a OpenJPA
> limitation/bug or not.
>
>




--
View this message in context: http://n2.nabble.com/problem-when-pe...91p838052.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 05:46 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.