hibernate - How do you retrieve nested Sets? -
is there annotation i'm missing or limitation hibernate retrieval?
entities:
class { long id; set<b> b; @manytomany(fetch = fetchtype.eager) @jointable(name = "a_b", joincolumns = @joincolumn(name = "a_id"), inversejoincolumns = @joincolumn(name = "b_id") public set<b> getbs() { return b; } } class b { long id; set<c> c; @manytomany(fetch = fetchtype.eager) @jointable(name = "b_c", joincolumns = @joincolumn(name = "b_id"), inversejoincolumns = @joincolumn(name = "c_id") public set<c> getcs() { return c; } }
daos:
class adaoimpl { public load(long id) { return new a((a) session.load(a.class, id); } }
when attempt load a,
caused by: java.lang.nullpointerexception @ org.hibernate.engine.internal.statefulpersistencecontext.getloadedcollectionownerornull(statefulpersistencecontext.java:853)
i had issue similar had nested sets, , hashcode methods each showed in stack trace. in hashcode methods, referred each other, removed reference each object in hashcode methods, , no longer got exceptions
Comments
Post a Comment