openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Baptiste BRIAUD -- Novlog <j-b.bri...@novlog.com>
Subject Re: detach question
Date Sat, 05 Dec 2009 10:35:39 GMT
it work as you said, a second request is needed.

Thanks !
On Dec 3, 2009, at 15:55 , Rick Curtis wrote:

> When you call cc.merge(ooo); any changes made to that instance while it was
> detached will be persisted to the DB.
> 
> I assume your comment "Here I modify the ooo but I want this modif to be
> persist, not the other one before" means that you only want the changes from
> after the tran begins to be persistent... If that assumption is correct,
> you'll need to get a new instance of ooo to make the changes on.
> -- 
> Thanks,
> Rick
> 
> On Thu, Dec 3, 2009 at 8:49 AM, Jean-Baptiste BRIAUD -- Novlog <
> j-b.briaud@novlog.com> wrote:
> 
>> Hi the list,
>> 
>> Am i right on the following pseudo code ?
>> 
>>           // Note the detach.
>>           // getFullById come back with an instance of MyObject from the
>> primary key
>>           final MyObject ooo = detach(getFullById(cc....
>> 
>>           < Here I modify (a lot) ooo but don't wan't the modif to be
>> persist>
>> 
>>               try {
>>                   cc.beginTransaction();
>> 
>>                   <Here I modify the ooo but I want this modif to be
>> persist, not the other one before>
>> 
>>                   cc.merge(ooo);
>>                   cc.commitTransaction();
>> 
>>               } catch (...) {
>>                   cc.rollbackTransaction();
>>               }
>> 
>> Thanks !


Mime
View raw message