You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by RamAESIS <rs...@hcl.in> on 2009/02/24 09:03:24 UTC
Dirty check clarification
Hi,
I have a scenario as described below:
I have two entities A and B which are not related.
1.Begin transaction
2.Retrieve A
3.Retrieve B
4.Mutate A and B
5.Call EntityManeger.merge(A)
6.Call commit (when committing the state of both A and B is written to
database eventhough i have called merge only for entity A)
Is there any way to avoid saving all the dirty objects with the database
during commit?
Regards,
Ram
--
View this message in context: http://n2.nabble.com/Dirty-check-clarification-tp2376687p2376687.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: Dirty check clarification
Posted by RamAESIS <rs...@hcl.in>.
Thanks Milosz, it is working now.
Regards,
Ram
Miłosz Tylenda wrote:
>
> Ram,
>
> What if you try doing OpenJPAEntityManager.detach(B) after step 5? This is
> an OpenJPA-specific method. You will find more details on how to obtain an
> OpenJPAEntityManager here:
>
> http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_runtime_jpa
>
> Hope this helps,
> Milosz
>
>> Hi,
>>
>> I have a scenario as described below:
>>
>> I have two entities A and B which are not related.
>> 1.Begin transaction
>> 2.Retrieve A
>> 3.Retrieve B
>> 4.Mutate A and B
>> 5.Call EntityManeger.merge(A)
>> 6.Call commit (when committing the state of both A and B is written to
>> database eventhough i have called merge only for entity A)
>>
>> Is there any way to avoid saving all the dirty objects with the database
>> during commit?
>>
>> Regards,
>> Ram
>>
>> --
>> View this message in context:
>> http://n2.nabble.com/Dirty-check-clarification-tp2376687p2376687.html
>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>>
>>
>
>
--
View this message in context: http://n2.nabble.com/Dirty-check-clarification-tp2376687p2378369.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: Dirty check clarification
Posted by Miłosz Tylenda <mt...@o2.pl>.
Ram,
What if you try doing OpenJPAEntityManager.detach(B) after step 5? This is an OpenJPA-specific method. You will find more details on how to obtain an OpenJPAEntityManager here:
http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_runtime_jpa
Hope this helps,
Milosz
> Hi,
>
> I have a scenario as described below:
>
> I have two entities A and B which are not related.
> 1.Begin transaction
> 2.Retrieve A
> 3.Retrieve B
> 4.Mutate A and B
> 5.Call EntityManeger.merge(A)
> 6.Call commit (when committing the state of both A and B is written to
> database eventhough i have called merge only for entity A)
>
> Is there any way to avoid saving all the dirty objects with the database
> during commit?
>
> Regards,
> Ram
>
> --
> View this message in context: http://n2.nabble.com/Dirty-check-clarification-tp2376687p2376687.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
>