Hello,
I am using the following mapping:
Code:
<hibernate-mapping>
<class entity-name="BlankEntity">
<id name="id_" type="long">
<generator class="native"/>
</id>
</class>
<joined-subclass entity-name="up_CardInformation" extends="BlankEntity">
<key column="up_CardInformation_id_"/>
<list name="up_cardUsage">
<key column="up_CardInformation_id"/>
<list-index column="LIST_INDEX"/>
<one-to-many class="up_CardUsage"/>
</list>
</joined-subclass>
<joined-subclass entity-name="up_CardUsage" extends="BlankEntity">
<key column="up_CardUsage_id_"/>
<property name="up_cuSite" type="string"/>
</joined-subclass>
</hibernate-mapping>
I am using DOM4J entity mode. When I load "up_CardInformation" entity, Hibernate (3.2.5) also loads "up_cardUsage" collection regardles of default lazy mode. I tried to set lazy attribute = "true" for "up_cardUsage" list, but it does not help. From the other hand, lazy collection loading works fine, if I switch entity mode to MAP.
I found out, that org.hibernate.type.CollectionType.getCollection(Serializable, SessionImplementor, Object) method ignores lazy collection loading mode, because of initializeImmediately(EntityMode) method:
Code:
protected boolean initializeImmediately(EntityMode entityMode) {
return entityMode == EntityMode.DOM4J;
}
1. As I understand, there is no any way to use lazy loading for DOM4J entity mode. Am I correct?
2. Using DOM4J entity mode, I found some other bugs/problems like
https://forum.hibernate.org/viewtopic.php?f=1&t=957391, impossibility of using null values. Does MAP entity mode free of such critical bugs?