This one time, at band camp, Stein M. Eliassen said:

SME>I'm trying to convert some existing code to Castor for storing files in 
SME>mysql, but it is causing me some headache :-(
SME>
SME>I've read http://castor.exolab.org/types.html#BLOB-and-CLOB-Types, but 
SME>still don't get it.
SME>
SME>The field is set to stream,  but it seems that only plain text-files is 
SME>working.
SME>
SME>The data is written to database for any file, but I must be doing 
SME>something wrong because after loading the object from the database and 
SME>write it to a response-object in a servlet I get a data-format error 
SME>(I'm trying to display an image-file).
SME>
SME>Can I initialize the field with a FileInputStream and Castor writes it 
SME>to the database?
SME>
SME>How do I use the stream-object after Castor have initialized the field 
SME>after I've loaded the object?
SME>
SME>This sounds like basic java-questions, but I have working code that I 
SME>wanted to handle with Castor instead.

Stein,

How exactly are you handling the LOB? What Java type is the LOB in
your code? When I wrote an app a few years ago that used CLOBs I mapped
them to a java.sql.Clob and in the code I used the java.io.File and the
java.io.FileReader because I pulled files right off of the filesystem. If
my memory serves me, I believe that I did this with both text files
and gifs. 

Please post the relevant portions of the object mapping and of your code.

Bruce
-- 
perl -e 'print unpack("u30","<0G)[EMAIL PROTECTED]&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to