In migrating from 2.1 to 3.0, I am finding significant performance problems when the session factory digests the mapping files. I have about 150 mapping files that were converted from 2.1 to 3.0 (via xdoclet regeneration). My performance has since suffered greatly. When the SessionFactory loads the mappings it now takes nearly 3 minutes, vs. about 10 seconds in 2.1!!!! Here's a sample 3.0 mapping.. Any ideas please - I know there may be some changes to the mapping file (such as role?), but xdoclet is not putting them in... would this have an impact?
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping
>
<class
name="gov.mass.eos.business.model.ce.household.Referral"
table="Referral"
select-before-update="true"
>
<id
name="referralId"
column="ReferralId"
type="java.lang.Long"
unsaved-value="null"
>
<generator class="sequence">
<param name="sequence">ReferralId</param>
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-Referral.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>
<property
name="typeCode"
type="java.lang.String"
update="true"
insert="true"
column="TypeCode"
length="10"
/>
<property
name="effectiveDate"
type="java.util.Date"
update="true"
insert="true"
column="EffectiveDate"
length="7"
/>
<property
name="followupCode"
type="java.lang.String"
update="true"
insert="true"
column="FollowupCode"
length="10"
/>
<many-to-one
name="household"
class="gov.mass.eos.business.model.ce.household.Household"
cascade="none"
outer-join="auto"
update="true"
insert="true"
>
<column
name="HouseholdId"
/>
</many-to-one>
<many-to-one
name="referralOrganization"
class="gov.mass.eos.business.model.ce.household.ReferralOrganization"
cascade="none"
outer-join="auto"
update="true"
insert="true"
>
<column
name="ReferralOrganizationId"
/>
</many-to-one>
<property
name="lastUpdateDateTime"
type="java.util.Date"
update="true"
insert="true"
column="lastUpdateDateTime"
/>
<property
name="lastUpdateProgramName"
type="java.lang.String"
update="true"
insert="true"
column="lastUpdateProgramName"
/>
<property
name="lastUpdateStaffMemberId"
type="java.lang.Long"
update="true"
insert="true"
column="lastUpdateStaffMemberId"
/>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-Referral.xml
containing the additional properties and place it in your merge dir.
-->
</class>
</hibernate-mapping>
Hibernate version:3.0
Code between sessionFactory.openSession() and session.close():
public static Session currentSession() throws HibernateException {
Session session = (Session) threadLocal.get();
if (session == null || !(session.isOpen())) {
if (sessionFactory == null) {
try {
Configuration config = new Configuration();
sessionFactory = config.configure().buildSessionFactory();
}
catch (Exception e) {
log.error(SESSION_FACTORY_ERROR);
throw new EosRTException(SESSION_FACTORY_ERROR, e);
}
}
session = sessionFactory.openSession();
threadLocal.set(session);
}
return session;
}
Name and version of the database you are using:Oracle10.g