Hi,
Just upgrading to H3.0.5, I have got my app working fine by adding default-lazy="false" to some of my mapping documents.. I am now going through gradually moving to default lazy=true.
But H3 is excessively lazy.. The following code does not even issue a database query at all!!
session = HibernateUtil.currentSession();
aiDocument = (AiDocument) session.load(AiDocument.class,
indexID);
HibernateUtil.closeSession();
When I then try to access any of its properties it gives a lazyinitializationexception. Obviously I can add code to ensure this doesn't happen but I don't understand why this is the default. Here is my mapping document.
<class name="AiDocument"
table="document">
<id name="indexId" column="document_id" type="java.lang.Integer">
<generator class="assigned" />
</id>
<property name="aiClass" column="ai_class" type="java.lang.String" />
<property name="aiSubclass" column="ai_subclass"
type="java.lang.Integer" />
<property name="documentNo" column="document_no"
type="java.lang.Integer" />
<property name="year" column="year" type="java.lang.String" />
<property name="title" column="title" type="java.lang.String" />
</class>
Regards,
Damon.
|