db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christiaan <christiaan...@hotmail.com>
Subject Re: Fwd: Evicting an embedded object.
Date Sat, 28 Mar 2009 10:39:07 GMT

Hi Craig,
it is probably the same case. I am using Kodo (which as you probably know
uses OpenJPA as a base library). I registered this issue with Oracle and
through their support I got in discussion with engineering whether this is a
bug or not. The original bug is actually that the statemanager is nullified,
whereas I still need to retrieve it after the evict. Maybe as a remark to
this, section 10.3 "pre-clear" is more specific about what should be
cleared:
"The method is called during any state transition to hollow. Non-persistent,
non-transactional fields should be cleared in this method. Associations
between this instance and others in the runtime environment should be
cleared."

then the hollow state itself (5.5.4):
"JDO instances that represent specific persistent data in the datastore but
whose values are not in the
JDO instance are hollow."

Is this intentional? Anyway, to avoid further discussion I proposed to
support to put the question on the jdo mailing list. Appearently,
engineering did the same on OpenJPA. (I actually registered the original
issue already in OPENJPA-453, back in 2007)

hope that clarifies it,
Christiaan


Craig L Russell wrote:
> 
> This sounds familiar...
> 
> Craig
> 
> Begin forwarded message:
> 
>> Hi all,
>>
>> I have a question regarding evicting an embedded object.
>>
>> When I call an evict on a persistent non-transactional object and if  
>> I call isPersistent() before and after evict then both returns true.
>>
>> When I do the same for an embedded object then I get false on the  
>> isPersistent() call after evict.
>>
>> I did not find any documentation around evicting an embedded object.
>>
>> The way I understand Evict is that it removes the object from cache  
>> but why is the persistence capability of the embedded object is  
>> removed and also why is it not consistent with a non-embedded object ?
>>
>> Here is a sample code, lets say there is an Order object (@Entity)  
>> and comment object (@Embeddable) that is embedded inside Order.
>>
>> The following returns true, true ( outside transaction boundaries):
>>
>> System.out.println("isPersistent:" +  
>> OpenJPAEntityManager.isPersistent(ord));
>> OpenJPAEntityManager.evict(ord);
>> System.out.println("isPersistent:" +  
>> OpenJPAEntityManager.isPersistent(ord));
>>
>> The following returns true, false ( outside transaction boundaries):
>>
>> Comment ord_cmt = ord.getComment();
>> System.out.println("isPersistent:" +  
>> OpenJPAEntityManager.isPersistent(ord_cmt));
>> OpenJPAEntityManager.evict(ord_cmt);
>> System.out.println("isPersistent:" +  
>> OpenJPAEntityManager.isPersistent(ord_cmt));
>>
>> Please let me know if you need a complete test case.
>>
>> OpenJPA version: openjpa-1.1.0-r422266:657916
>>
>> Regards,
>> Ravi.
>>
>>
>> -- 
>> View this message in context:
>> http://n2.nabble.com/Evicting-an-embedded-object.-tp2528068p2544592.html
>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>>
> 
> Craig L Russell
> Architect, Sun Java Enterprise System http://db.apache.org/jdo
> 408 276-5638 mailto:Craig.Russell@sun.com
> P.S. A good JDO? O, Gasp!
> 
> 
>  
> 

-- 
View this message in context: http://www.nabble.com/Fwd%3A-Evicting-an-embedded-object.-tp22751565p22755521.html
Sent from the JDO - Development mailing list archive at Nabble.com.


Mime
View raw message