ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Chandler <a...@chandlerfamily.org.uk>
Subject confused about storing image data in my database
Date Mon, 07 Nov 2005 18:56:49 GMT
Having made the first release of my family tree application its time to look 
to the future.

Once of the things that has been suggested to me is to store pictures of the 
people and their marriages in the database.

I am using Postgres which seems to have more than one method of binary 
storage.  For very large binary objects (the documentation implies things in 
the order of 1GB or more) then a separate large binary object is available 
refered to via a datatype called OID in the table which logically holds it.  
As far as I can see from the jdbc documentation this is mapped to the 
jdbctype BLOB.

But it also has a type of bytea which seems to map through to the java type of 
byte[].  These seems much more appropriate for storing jpeg images (which is 
what I plan).

In the ibatis wiki I noticed something that says you can get at binary data by 
making a result map with the result having an entry with the jdbctype="BLOB" 
in it.

The only write up I could find about jdbc types does not really talk about the 
type as expressed in the ibatis xml - but it does say that there is a 
getBytes jdbc api (which is what bytea is mapped to).

Can I just have a property in my java object which has a byte array (with the 
getter and setter methods)  and use result maps to declare a property for 
this which maps on to the column in the database which is of type bytea.  Do 
I need to do anything else?  Specifically do I need to use the jdbctype 
attribute, and if I do what do I use for it?

-- 
Alan Chandler
http://www.chandlerfamily.org.uk
Open Source. It's the difference between trust and antitrust.

Mime
View raw message