-->
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: lazy initialization on properties
PostPosted: Wed Aug 25, 2004 11:34 am 
Newbie

Joined: Thu Jun 03, 2004 2:10 am
Posts: 19
I was wondering if there was a way to have the fileData property lazy (instead of the whole class). That way i could show a file list and only retrieve the fileData when needed.

The mapping is below:


Hibernate version: 2.1.6

Mapping documents:

<class name="ProjectFile" table="project_file" lazy="true">

<meta attribute="implement-equals">true</meta>

<id name="projectFileId"
type="long"
column="project_file_id"
unsaved-value="-1">
<generator class="native"/>
</id>

<many-to-one name="project"
class="com.123.Project"
column="project_id"
unique="true"
not-null="true">
<meta attribute="use-in-tostring">true</meta>
<meta attribute="use-in-equals">true</meta>
</many-to-one>

<property name="fileName"
column="file_name"
type="string"
length="250"
not-null="false">
<meta attribute="use-in-tostring">true</meta>
<meta attribute="use-in-equals">true</meta>
</property>

<property name="mimeType"
column="mime_type"
type="string"
length="50"
not-null="false">
<meta attribute="use-in-tostring">true</meta>
</property>

<property name="dateCreated"
column="date_created"
type="timestamp"
not-null="false">
<meta attribute="use-in-tostring">true</meta>
<meta attribute="use-in-equals">true</meta>
</property>

<property name="fileSize"
column="file_size"
type="int"
not-null="false">
</property>

<property name="fileData"
column="file_data"
type="binary"
length="5000000"
not-null="false">
</property>

</class>

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 25, 2004 12:05 pm 
Regular
Regular

Joined: Wed Aug 18, 2004 5:16 am
Posts: 69
Location: Modena, Italy
I suggest to manage file content outside ProjectFile class and manage them as streams to support large files and never load all in memory


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.