hibernate - fetch type in JPA -
i'm using jpa, jboss 7a.. old problem don't show of code , stacktrack caused by: org.hibernate.loader.multiplebagfetchexception: cannot simultaneously fetch multiple bags error caused code in entity:
@manytomany(fetch=fetchtype.eager) @jointable( name="post_rel_component" , joincolumns={ @joincolumn(name="post_post_id", nullable=false) } , inversejoincolumns={ @joincolumn(name="component_component_id", nullable=false) } ) private list<component> components; //bi-directional many-to-one association user @manytoone @joincolumn(name="post_username", nullable=false) private user user; //bi-directional many-to-many association tag @manytomany(mappedby="posts", fetch=fetchtype.eager) private list<tag> tags; i found 3 solutions overcome problem on internet. fixed changing private list<tag> tags private set<tag> tags. don't understand causes problem. of webpages show how fix don't mention causes problem. can show why? thanks.
this due hibernate specific bug https://hibernate.atlassian.net/browse/hhh-1718 not exist in other jpa providers. quick read of bug suggests limitation joining 2 collections/lists, occurs default when marking collections eager. bug lists other workarounds.
Comments
Post a Comment