hibernate - Share a collection of datas with two entities -
i can't find answer on internet question, hope have information here :-)
just information, here first class, attribut :
@entity @table(name="t_attribut") public class attribut implements serializable{ private long id; private set<locstring> label = new hashset<locstring>(0); @manytomany(fetch=fetchtype.eager, cascade=cascadetype.all) public set<locstring> getlabel() { return label; } ... and here class locstring :
@entity @table(name="t_loc_string") public class locstring implements serializable { @id @generatedvalue(strategy=generationtype.auto) @column(name="id") private long id; @column(name="locale") private string locale; @column(name="value") private string value; right now, have in database attribut set of locstring save. create new attribut (with new id) using same set of locstring (same reference in database, same reference in memory, same ids). when try save attribut have following exception :
org.springframework.orm.hibernate4.hibernatesystemexception: found shared references collection: com.nomia.onmap.model.attribut.label; nested exception org.hibernate.hibernateexception: found shared references collection how can avoid exception. possible hibernate ?
thanks lot in advance
clement
Comments
Post a Comment