openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Nine <t...@spidertracks.com>
Subject Re: Possible bug in Statemanager.fetchObjectId() with Entity Id fields in composite id and application assigned identities? Appears to be flush cascade related.
Date Thu, 14 Apr 2011 01:30:03 GMT
Hi all,
  Because this has broken my build I've started fixing this issue on a
separate branch.  You can view this branch here.

https://github.com/riptano/hector-jpa/tree/compositeentityid



On Thu, 2011-04-14 at 12:42 +1200, Todd Nine wrote:

> Hi guys,
>   I've read the JPA spec several times, as well as section 4.2 in the
> 2.1.0 documentation and I believe I've mapped this relationship
> correctly.
> 
> https://github.com/riptano/hector-jpa/blob/master/src/test/java/com/datastax/hectorjpa/bean/Observe.java
> 
> I'm hitting what seems to be a bug in the internal OpenJPAStateManager
> api. This is essentially what I thought would occur on flush.
> 
> 1. User target is assigned their OID via the generator
> 2. User owner is assigne their OID via the generator
> 3. A call to StateManager.fetchObjectId() on a statemanager for the
> Observe class will return an instance of Observe.ObserveId with both
> the owner UUID and the target UUID populated since it will internally
> invoke assignObjectId(true)
> 
> 
> What I'm seeing instead
> 
> 1. User instance "target" is assigned an OID
> 2. User instance "owner" is assigned an OID.
> 3. Subsequent calls to StateManager.fetchObjectId() return an OID
> instance with either both fields null, or a single field populated
> depending on the instance that's getting flushed.  For instance, if
> I'm saving the User and cascading the observing, the "owner" uuid will
> be populated but the "target" will not.
> 
> 
> Am I doing something incorrectly?  The files that are causing the
> issues are here.
> 
> https://github.com/riptano/hector-jpa/blob/master/src/main/java/com/datastax/hectorjpa/store/EntityFacade.java
line 374.  When an Observe is flushed both ID's are null, even though the relationship graph
is correctly constructed.  
> 
> 
> https://github.com/riptano/hector-jpa/blob/master/src/main/java/com/datastax/hectorjpa/meta/collection/OrderedCollectionField.java
line 341.  In this case, only 1 of the 2 Ids are assigned.  It seems to be assigning the entity
that owns the field in the composite Id, but not the other id.
> 
> 
> 
> It appears that cascading the flush to embedded Id entities is not
> working correctly in my current usage.  Am I doing something
> incorrectly, or is this a bug?
> 
> Thanks,
> 
> Todd
> 
> 
> 
> 
> 
> 
> 
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message