[Hibernate]特定のバージョンでone-to-manyタグにproperty-ref属性を指定できない
参考URL
Hibernate Mapping problem with unrelated collection - Stack Overflow
[HHH-2862] Collection is not associated with any session exception when doing an eager fetch on a non-unique collection. - Hibernate JIRA
問題となるHibernateのバージョン
3.1.3~3.2.5
問題となるhbm
<set name="items" inverse="true" fetch="join" cascade="all"> <key property-ref="hogeCode"> <column name="piyo_code" /> </key> <one-to-many class="hoge.example.Piyo" /> </set>
keyタグのproperty-refを外す(=PKで参照する)と動くが、property-refがあると検索時に以下の例外が発生する
org.hibernate.HibernateException: collection is not associated with any session