Microsoft Sql Server 2005 datatype mapping issues [message #607413] |
Thu, 06 March 2008 18:07 |
Eclipse User |
|
|
|
Originally posted by: syedrizwanhussain.yahoo.com
Hi all,
I am using Eclipse 3.3.1.1 with Dali 1.0.2. My database is Microsoft Sql
Server 2005 (v. 9.0.3042). I have both Microsoft Sql Server 2005 JDBC
Driver and jTDS Driver.
I created a table ttt to check the datatype mapping.
create table ttt
( id int not null primary key,
col_bigint bigint null,
col_int int null,
col_smallint smallint null,
col_tinyint tinyint null,
col_bit bit null )
Then I use JPA Tools --> Generate Entities to generate Ttt entity in both
Microsoft and jTDS Drivers cases. I saw that Dali maps this way:
Database DataType --> Java DataType
-----------------------------------
bigint --> long
int --> int
smallint --> short
tinyint --> java.lang.Object
bit --> int
I dont like what Dali is doing with "tinyint" and "bit" database
datatypes. I was hoping for:
tinyint --> byte
bit --> boolean
I can understand the logic why Dali is doing it like this. tinyint's range
in database is 0 to 255 while byte's range is -128 to 127 so there is a
conflict. Similarly bit is really an int and can take value of 1, 0 or
null.
But the system i am working has rules in place to makes sure that tinyint
has values from 0 to 127 and bit has values of 0 or 1. So I can safley
maps tinyint --> byte and bit --> boolean.
My question is how can i configure Dali so that it follows the above 2
rules?
Thanks
|
|
|
Powered by
FUDForum. Page generated in 0.01403 seconds