Nov 30th, 2011, 03:06 PM
Why and how to avoid selects on associated entities while updating?
When I use the saveAndFlush(myObject) method, I see queries that select the associated entities just before the update.
For instance I have a class User and a class Company, the user as a ManyToOne association with company.
Let's say I delete a company and just after I want to update the user with the company set to null (let's forget about database foreign keys or constraints for now), it breaks because the saveAndFlush(user) does a select to retrieve the company which doesn't exist anymore since I just deleted it.
Why those selects? How can I avoid them?
Dec 5th, 2011, 12:04 PM
Anybody? Maybe someone from Spring?
Dec 12th, 2011, 09:36 AM
Still waiting for an explanation...