Results 1 to 3 of 3

Thread: Why and how to avoid selects on associated entities while updating?

  1. #1

    Default Why and how to avoid selects on associated entities while updating?

    Hi guys,

    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?

    Thanks!

  2. #2

    Default

    Anybody? Maybe someone from Spring?

  3. #3

    Default

    Still waiting for an explanation...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •