Hibernate: Why does changing the bag lead to weird ADD and DELETE in the database?

I have an n: m association between the two classes User and Role, implemented as a bag with lazy = "extra". The association is stored in the sind association table, the user can have many roles, and the role can be associated with many users.

Now, when I add a new role to the user, hibernate emmits sql code, which first deletes all the entries in the eassociation table and then adds them again and the new association.

I would like to know why this is happening and how I can get rid of this behavior.

Ralph

+3
source share
1 answer

: Hibernate , . , .

. ,

+2

Source: https://habr.com/ru/post/1756130/


All Articles