Hibernate exception when loading more than one collection

March 20th, 2009

Applies to:
Hibernate

Description:
Occurs when trying to load more than one collection.

Cause:
You have tried to load more than one collection.

admin JAVA-Hibernate

  1. admin
    March 20th, 2009 at 10:28 | #1

    Here are the solutions:
    a. do not use a bag semantic: use a Set or a List annotated with @IndexColumn
    b. use a @CollectionId
    c. use @FetchMode(SELECT) or @FetchMode(SUBSELECT)
    The underlying reason is that you cannot load more than one bag semantic collection in a given SQL query conceptually, so you won’t find this feature in other products either.

  1. No trackbacks yet.