Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] EntitEntityManager.remove: Why does it care about nullable=false?


James Sutherland wrote:
> 
> The update occurs because in many cases an object must be updated before
> being deleted, such as for constraints between objects.  
> 
> 
> 
>> AFAIK, that is only needed for Parent OneToMany Children relationships,
>> and in that case, you would update the child  object to make it possible
>> to delete the parent  object, but in this case, I am trying to delete the
>> same object I updated, the only moment I think this would be needed is
>> for a recursive relationship where an object is configured as a parent of
>> itself... all other cases (IMO) could be optimized to avoid the update...
>> am I wrong?
>> 
> 
> If you do not want the object updated, the best solution is to not modify
> it.  You could potentially also refresh or detach (unregister and
> reregister) the object before calling remove to clear any changes made to
> it.  There is also an EclipseLink option shouldPerformDeletesFirst that
> can avoid this, but in general, do not update an object that you do not
> want updated.
> 
> 
> 
>> 
>> Is shouldPerformDeletesFirst  smart enough to know that it will fail for
>> recursive relationship and fall back to the update then delete behavior
>> on those cases?
>> 
>> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/EntitEntityManager.remove%3A-Why-does-it-care-about-nullable%3Dfalse--tp22942681p22951883.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top