Answer the question
In order to leave comments, you need to log in
Hibernate removes records from an adjacent table in a many-to-many relationship when calling getter, why?
When trying to execute the getWriters method from an object of the Music class, the hibernet makes a select request for a selection of writers whose music id matches the one for which the selection is taking place.
But immediately after that, hibernet deletes the record data from the Music_Writers table, which is intermediate between Music and Writer, between which a many-to-many relationship is established. Why is this happening?
All this happens only after getWriters, but if you do not call this method, then no problems arise. I tried to change the inverse attribute in the xml files for the Music and Writer classes, and if it is set to true, then such garbage does not happen, but the data is also not added to the Music_Writers table.
Thanks in advance!
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question