• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate does delete and insert during a find.

 
camilla bat
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I try to figure out why hibernate does insertes and deletes while I'm actually doing a select. In our app. hibernate does a search on a user with a given username to retrieve the userobject (Hibernate.find()). During this search it does 4 selects, 1 delete(?!) and 2 inserts(?!).

The usertable has a many-to-many connection with a grouptable. So when I retrieve a user it also retrieves all its groups. But how can it actually perform a delete and insert during this query?

This hasn't been a problem until now when I'm doing some stresstesting. Beacause of this I get sql exceptions saying: "Attempt to insert duplicate key row in object ...".

Does someone have an idea about this? Maybe I should provide more information..?

Thanks for any help on this topic
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Maybe I should provide more information

Please do. Hibernate does not perform any deletes/updates/inserts during a select, so it must be something in your code. Could you post the code you are using to do the select?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic