Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
3.2.1
Mapping documents:
<class name="MachineAddress" table="machine_address" lazy="true" >
<id name="MadId" type="int" column="mad_id" unsaved-value="0" >
<generator class="assigned" />
</id>
<version name="VersionId" column="mad_version_id" type="int" />
<property name="DeleteFl" column="mad_delete_fl" type="yes_no" not-null="true" />
<property name="PartitionId" column="ptn_id" type="int" not-null="true" />
<property name="MacId" column="mac_id" type="int" not-null="true" />
<property name="MadHostAddress" column="mad_host_address" type="com.xxx.StringType" not-null="false" />
<property name="MadOrderNo" column="mad_order_no" type="int" not-null="true" />
<many-to-one name="MachineTbl" class="com.xxx.MachineTbl" column="mac_id" update="false" insert="false" />
</class>
<class name="MachineTbl" table="machine_tbl" lazy="true" >
<id name="MacId" type="int" column="mac_id" unsaved-value="0" >
<generator class="assigned" />
</id>
<version name="VersionId" column="mac_version_id" type="int" />
<property name="DeleteFl" column="mac_delete_fl" type="yes_no" not-null="true" />
<property name="PartitionId" column="ptn_id" type="int" not-null="true" />
<property name="MacName" column="mac_name" type="com.xxx.StringType" not-null="true" />
<set name="MachineAddresses" lazy="true" inverse="true" >
<key column="mac_id"/>
<one-to-many class="MachineAddress"/>
</set>
</class>
Code between sessionFactory.openSession() and session.close():
N/A
Full stack trace of any exception that occurs:
N/A
Name and version of the database you are using:
SQLServer 2000 or Oracle 9
The generated SQL (show_sql=true):
N/A
Debug level Hibernate log excerpt:
N/A
I have a project that uses ~400 classes/mappings, I've provided two of the mappings above. The session factory build time for these 400 mappings is around 20-30 seconds which is fine except in development when it becomes a bit of a drag when changing code and reinitialising esp with Apache Tomcat. The XML parsing is extremely quick it is the session factory that is taking the majority of the time.
Debugging showed most of the time building the cglib proxies. Because all my classes are lazy it would have to build around 400 proxy classes. I would like, and I do not believe this is possible at the moment, to disable proxy generation across the board but keep my <many-to-one> and <set> declarations. I use these relationships extensively in HQL for fetching/joining multiple tables but i never use them to fetch objects in the java code. (I hide the POJOs behind interfaces so coders can't call getMachineTbl() on a MachineAddress in the example above).
Because of this the proxies never get used I would like to disable them to improve my startup time WITHOUT removing the relationships themselves which I use in HQL.
I am quite prepared to get my hands dirty in the code to try and do this myself but I would appreciate any advice or prior experience anyone has in this area.
If this is possible in the current product out of the box that would be excellent.
Thanks in Advance.
Regard.
Mike.