Meaningless Drivel is fun!
The moose likes Object Relational Mapping and the fly likes Hibernate lazy property fetching Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate lazy property fetching" Watch "Hibernate lazy property fetching" New topic

Hibernate lazy property fetching

Ricardo Alcazar

Joined: Oct 28, 2005
Posts: 11
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.

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

<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"/>



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

Joined: Nov 25, 2005
Posts: 18
try this .may be it works out

see the following url:
[ December 06, 2005: Message edited by: Mohd. Yakub ]
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

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 ]

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
I agree. Here's the link:
subject: Hibernate lazy property fetching
It's not a secret anymore!