-->
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: Save files without put them all in memory using binary colum
PostPosted: Tue Oct 05, 2004 12:10 am 
Newbie

Joined: Wed Jun 02, 2004 12:50 pm
Posts: 3
Location: Central America
Hibernate version: 2
Mapping documents:
<hibernate-mapping package="xxx.File">

<class name="File"

table="file">


<id name="fileId"

type="java.lang.Long"

column="file_id">


<generator class="sequence">

<param name="sequence">sec_file</param>

</generator>

</id>


<property

name="imagen"

column="imagen"

type="binary"

not-null="true"

/>

</hibernate-mapping>

Name and version of the database you are using: PostgreSQL 7.4
Java version: Java 1.4
Container: Tomcat5 using connection pooling

Problem Description:
I have a table which stores files. Using PostgreSQL I decided to use a bytea column to store the data. This is the best type for my system.

To map the colum I used "type=binary", but There is a problem when the file is big (eg. 50MB), because In the Class I have to converted it to a byte[] and this put all the file in memory causing an "out of memory" error in tomcat5. I can reserve more memory for tomcat5, but it isn't the best solution, i think, because it could be serveral clients saving and retrieving files.

I ask you for help or clues to find a solution in wich I can save the file without put it all in memory, with a BufferedStream or something like that.

Thank you for your patience and help.


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.