E
E
Evreich2016-04-18 23:34:55
Java
Evreich, 2016-04-18 23:34:55

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!
t7e8AXgJPag.jpghlwSLwkp_JE.jpgtWXOF99eHZw.jpgxXfAcdGjF2A.jpgyw-P7ONCQBo.jpg8WTJvjnor2Y.jpgVNpKqgYRbmk.jpgrd2Yk57Mc8o.jpgS8TSa4bdB00.jpg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vayho, 2016-04-19
@Evreich

This is a bug related to the hibernate.enable_lazy_load_no_trans=true flag, try upgrading to 4.3.5+.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question