-->
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.  [ 1 post ] 
Author Message
 Post subject: Mapping two different DB types in hibernate xml.
PostPosted: Thu Dec 31, 2009 4:52 am 
Newbie

Joined: Thu Dec 31, 2009 3:16 am
Posts: 1
Hi Everyone ,
I am using hibernate 3.2.1 for inserting data in oracle and postgres, my problem is ,i need to map a column whose datatype is different in both databases .

say for EG : I have a string which i have to store as number in postgres and as varchar2 in oracle.

One way i found is ,using UserType of hibernate . In CustomUserType I am detecting the DB based based on prepared jdbc statement of nullsafeget() method and based on DB i am cating the value.

But the sqltypes() method can't take both the sql types (number and varchar).


Code:
private static final int[] SQL_TYPES = {java.sql.Types.VARCHAR};         
        public int[] sqlTypes() {
          return SQL_TYPES;
        }



Can someone please clarify what is the significance of sqltypes() method and is there any other way in hibernate to implement my use case ( insert different datatypes for same column.)

Hope i am clear ..

Thanks in advance,
Sas


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

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.