cannot simultaneously fetch multiple bags
Error Message: cannot simultaneously fetch multiple bags
Possible Solution:
Possible Solution:
A
bag refers to a java.util.List or java.util.Collection that is annotated with
@OneToMany or @ManyToMany. If there is more than one bag in your application
that has a non-lazy fetch, then Seam will fail with this error message. For an
explanation of why and for additional detail on the workarounds, read Eyal
Lupu’s fine blog entry about the issue.
There are three relatively easy workarounds:
- Change all but one of your non-lazy collections to java.util.Set.
- Remove eager fetches on all but one bag:
@OneToMany(fetch=FetchType.LAZY)
LAZY is the default, so you could also just remove the fetch attribute.- Add @IndexColumn to replace bag semantics with List semantics:
@IndexColumn(name=”INDEX_COL”)


This has helped me no end, thanks
Reply to this
thanks so much... this really helped me
Reply to this
If you are using JPA 2.0 use @OrderColumn instead of @IndexColumn
Reply to this