-->
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.  [ 2 posts ] 
Author Message
 Post subject: Mapping java byte[] to sybase IMAGE type
PostPosted: Thu Nov 09, 2006 10:13 am 
Newbie

Joined: Wed Mar 08, 2006 10:33 pm
Posts: 16
Location: Brazil
Hello,

I have a system using hibernate-3.2+entity-mgr+annotations that works with Oracle, PostgreSQL, MySQL5, SQLServer. I want it to also work with Sybase.

But the Sybase IMAGE column type is giving me a problem. I am mapping a java byte[] field to the appropriate database types -- such as oracle's LONGRAW -- without problems. However, since this field is used to store a large value -- raw e-mail mime data -- the mapping of byte[] TO sybase column is IMAGE, not VARBINARY(n). When I try to insert or read from this IMAGE column I get a Sybase datatype conversion error.

I don't think that a subclass of SybaseDialect that maps java btye[] to sybase VARBINARY(n) will work because the size of the data stored in the column is too big for the Sybase VARBINARY(n) type. So I'm stuck with IMAGE.

Is a custom UserType the answer? Can I make the custom UserType in such a way that it doesn't break the system when run against the other databases (oracle/sqlsserver, mysql, postgresql)?

If the UserType is the solution, how should it work? Should it alter the Sybase SQL -- and ONLY the *Sybase* SQL -- so that a CONVERT function is called during sql insert and select? Is that sensible and/or possible?

Thanks for any advice!


Top
 Profile  
 
 Post subject: yes, create a user-type
PostPosted: Fri Dec 08, 2006 10:09 am 
Newbie

Joined: Wed Mar 08, 2006 10:33 pm
Posts: 16
Location: Brazil
Of course a UserType was the solution... I can map byte[] to the appropriate CLOB, VARBINARY, LONGRAW, etc... after checking the sql dialect.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

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.