Hi All,
I have found this topic very useful. In our web application we are using Hibernate and the application is running well in local machines but when deployed in
testing servers we are facing lazy initialization exception. i am providing my hbm file(due to security issues i am not including query part:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class lazy="false" name="org.myapp.domain.ClassProgram" table="CLS_PGM" mutable="true">
<meta attribute="extends">org.myapp.generic.domain.AuditedDomainObject</meta>
<id unsaved-value="null" name="code" type="java.lang.String" column="CLS_PGM_CDE">
<generator class="assigned" />
</id>
<property name="description" column="CLS_PGM_DSC" type="java.lang.String" />
<property name="name" column="CLS_PGM_NAM" type="java.lang.String" />
<property name="physicalClassProgram" column="PHYSCL_CLS_PGM" type="java.lang.String" />
<set name="tests" lazy="true" inverse="true" cascade="none">
<key>
<column name="CLS_PGM_CDE" />
</key>
<one-to-many class="org.myapp.domain.Class" />
</set>
</class>
<query name=""><![CDATA[
]]></query>
</hibernate-mapping>
In the above code i have changed <set name="tests" lazy="
false" inverse="true" cascade="none">
the application is running fine but we are getting the 'lazy initialization exception' on the other assoiated class, in this case, its Class.
please let me know how to proceed to handle this exception.
Thanks,
Shehroze