-->
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.  [ 1 post ] 
Author Message
 Post subject: How do I create a mapping for this use case?
PostPosted: Thu Nov 05, 2009 8:19 am 
Newbie

Joined: Tue Mar 28, 2006 9:36 am
Posts: 4
I have an entity called Document and it has a one-to-many relationship with entity Version. Version has a field PDF which contains blobs. I wrote the following mapping for Document:
Code:
<class name="Document" table="Document" discriminator-value="DOC" lazy="false">
      <id name="id" type="long" column="ID">
         <generator class="increment" />
      </id>
      <set name="versions" cascade="all">
         <key column="DOCUMENT_ID" />
         <one-to-many class="Version" />
      </set>
</class>


And Version has the following mapping:
Code:
<class name="Version" table="VERSION" lazy="true">
      <id name="id" type="long" column="ID" >
         <generator class="increment" />
      </id>
      
      <property name="versionedDoc" column="pdf" type="com.company.pen.hibernate.usertypes.BinaryBlobType" />

</class>


I get out of memory exception when I try to fetch documents with their versions. I understand why that happens but how can I rewrite my mapping so that Version is lazily fetched. I thought setting lazy=true on Version was enough but I keep getting the same exception.

Thanks in advance to anyone who can help.

Regards,

Emmanuel


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

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.