-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Disabling proxies for lazy loading
PostPosted: Thu Nov 23, 2006 10:22 am 
Senior
Senior

Joined: Sun Jan 04, 2004 2:46 pm
Posts: 147
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.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 23, 2006 7:26 pm 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
I already read something about disabling Cglib enhancement, but I'm not sure it's even related to the initial proxies creation :-/.

my 2 cents :-)

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.