openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "C N Davies" <>
Subject RE: Delete or merge, update or merge ?
Date Thu, 13 Aug 2009 17:13:35 GMT
For my 2c worth. Delete by query might be cheaper, but for me it breaks the
ORMS model. The model relationships should manage all aspects of the model.
Performing a query in a true ORMS model seems to be a patch up job.

Just my 2c,


-----Original Message-----
From: Ravi Palacherla [] 
Sent: Thursday, 13 August 2009 9:41 PM
Subject: RE: Delete or merge, update or merge ?

Hi ,

I guess, If you mergeA with one less B , then the association between A and
B will be lost but the instance of B will not be deleted.

If you call em.remove(B) then the instance of B (corresponding row in B)
will be deleted.

Delete by query also should remove the instance of B.
If memory is a constraint and I do not want to pull all the instances of B
into memory then I will go with delete by query. I personally think ( I
could be wrong), delete by query is better in terms of memory and


-----Original Message-----
From: Jean-Baptiste BRIAUD -- Novlog [] 
Sent: Thursday, August 13, 2009 3:24 AM
Subject: Re: Delete or merge, update or merge ?

up : any advice on that point ?

On Aug 8, 2009, at 08:57 , Jean-Baptiste BRIAUD -- Novlog wrote:

> Hi,
> say I have one instance to delete, an instance of B knowing that A  
> contains one to many B.
> Should I merge A with one less B, that should delete the required B  
> or should I explicitly delete that B with a delete by query or  
> should I use the remove(thatB) API ?
> What are the differences in term of design, memory, performance, ... ?
> Quedtion also apply in case of a new B : merge on A, insert by query  
> or persist(thatB) on entityManager ?
> The same question apply to merge or update by query one B.
> Thanks !

View raw message