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-persist-object-using-JOINED-inhertitance-under-1.1.0-tp580291p790496.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to