You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-user@db.apache.org by tyju tiui <jc...@yahoo.com> on 2008/05/13 23:57:35 UTC

ddlutils: override default return object type

Hi,

I'm curious to know if it is currently possible to override the default return object for a specific platform.
For example, postgres can't deal with JAVA_OBJECT types so I'm serializing the object to a byte[] and storing the bytes.
I simply override the "setObject" method in postgres' platform implementation and it is seamless.

However, when I want to select the object it comes back as a byte[] instead of my original object.
Is there any place I can override in ddlutils to catch the byte[] and convert it back to an object automagically?

Thanks,

Ty



      

Re: ddlutils: override default return object type

Posted by Thomas Dudziak <to...@gmail.com>.
On Tue, May 13, 2008 at 2:57 PM, tyju tiui <jc...@yahoo.com> wrote:

>  I'm curious to know if it is currently possible to override the default return object for a specific platform.
>  For example, postgres can't deal with JAVA_OBJECT types so I'm serializing the object to a byte[] and storing the bytes.
>  I simply override the "setObject" method in postgres' platform implementation and it is seamless.
>
>  However, when I want to select the object it comes back as a byte[] instead of my original object.
>  Is there any place I can override in ddlutils to catch the byte[] and convert it back to an object automagically?

The insert/update/query functionality in DdlUtils is pretty basic
(intentionally). You might be better off using something like jDbi
(http://jdbi.codehaus.org) or similar for that.

That being said, in your case you probably also want to override the
getObjectFromResultSet method in the platform which does sort of the
opposite of setObject.

Tom