ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Butler <jeffgbut...@gmail.com>
Subject Re: confused about storing image data in my database
Date Mon, 07 Nov 2005 23:10:59 GMT
Ah...sorry.
 This is sometimes hard to work through. The problem is that bytea doesn't
map easily to a JDBC type - hence the posgresql documentation telling you
exactly what JDBC method to call. If bytea means that you should call
getBytes(), then I think you should use a byte[] in your bean, but NOT
specify type of BLOB in the result map. This will cause iBATIS to use the
ByteArrayTypeHandler, which calls getBytes().
 You can see how iBATIS decides what to do by looking at the class
com.ibatis.sqlmap.engine.type.TypeHandlerFactory. If there is a property of
type byte[], and JDBC type is not BLOB or LONGVARBINARY, then iBATIS will
use the ByteArrayTypeHandler - which should do what you want.
 I hope I understand it this time :)
 Jeff Butler

 On 11/7/05, Alan Chandler <alan@chandlerfamily.org.uk> wrote:
>
> On Monday 07 Nov 2005 20:56, Jeff Butler wrote:
> > For BLOBs, the property in your bean should be of type byte[]. In the
> > result map you may, or may not, need to specify jdbcType="BLOB" - it's
> > dependant on the driver (e.g. with DB2 it does not matter).
> > I'm not familiar with OID - the byte[] and BLOB might work. If not, then
> > try a property of type Object and cast it yourself to the proper type.
> > All else fails, use a custom type handler. But I think the byte[] and
> BLOB
> > combination works in most cases.
>
> I think you misunderstand me. I don't want to use the BLOB type. The
> question I am asking is how does the "bytea" type in Postgres map onto
> jdbc
> types, and further, whatever that type is (and I think it isn't BLOB) how
> does that map on to a byte array in ibatis
>
>
> --
> Alan Chandler
> http://www.chandlerfamily.org.uk
> Open Source. It's the difference between trust and antitrust.
>

Mime
View raw message