File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate lazy property fetching

 
Ricardo Alcazar
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all -

I have an object/relational mapping defined using hibernate 3.0. The table contains a binary column that I would like to set as a "lazy property".

When listing records from the table, binary data is downloaded for each record returned in the query resulting in a huge performance hit. Setting the mapping element with the attribute lazy="true" does not accomplish the intented "lazy" load.

<code>
<class name="com.dana.sealing.itchecklist.TaskFile" table="attachments">
<id name="id" type="integer" column="id">
<generator class="identity"/>
</id>

<many-to-one name="parent" column="history_id" not-null="true"/>
<property name="filename" type="string" not-null="true" column="filename" />
<property name="contentType" type="string" not-null="false" column="content_type" />
<property name="content" type="binary" not-null="false" column="content" lazy="true"/>

</class>

</code>

The documentation states this is possible, however, I have not been able to successfully implement this. Has anyone been able to get this to work and if so, can you provide the details of how to accomplish this?

Best Regards,
R. Alcazar
 
Mohd. Yakub
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
try this .may be it works out


see the following url:
http://forums.hibernate.org/viewtopic.php?t=941926&highlight=&sid=e85e783edb8f2fafc49b2b873dca3967
[ December 06, 2005: Message edited by: Mohd. Yakub ]
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you done the necessary bytecode instrumentation of your persistant class? Lazy property fetching won't work with a class that is compiled normally.
[ December 05, 2005: Message edited by: Paul Sturrock ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic