Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dali » Microsoft Sql Server 2005 datatype mapping issues
Microsoft Sql Server 2005 datatype mapping issues [message #434638] Thu, 06 March 2008 18:07 Go to next message
Eclipse UserFriend
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
Re: Microsoft Sql Server 2005 datatype mapping issues [message #434641 is a reply to message #434638] Mon, 10 March 2008 18:40 Go to previous message
Neil Hauge is currently offline Neil HaugeFriend
Messages: 475
Registered: July 2009
Senior Member
Hi,

Take a look at bug 214857 -
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=214857). This bug
describes the current limitation you are speaking of and also documents
the current workaround to the problem. You will also see what is planned
for the 2.0 release.

Let me know if you have any questions after taking a look at the bug.

Neil

Syed Rizwan Hussain wrote:

> 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
Re: Microsoft Sql Server 2005 datatype mapping issues [message #607416 is a reply to message #434638] Mon, 10 March 2008 18:40 Go to previous message
Neil Hauge is currently offline Neil HaugeFriend
Messages: 475
Registered: July 2009
Senior Member
Hi,

Take a look at bug 214857 -
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=214857). This bug
describes the current limitation you are speaking of and also documents
the current workaround to the problem. You will also see what is planned
for the 2.0 release.

Let me know if you have any questions after taking a look at the bug.

Neil

Syed Rizwan Hussain wrote:

> 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
Previous Topic:UML 2.1 and Dali demo
Next Topic:how to create tables using persistence.xml (glassfish, oracle xe)
Goto Forum:
  


Current Time: Thu Apr 25 16:18:18 GMT 2024

Powered by FUDForum. Page generated in 0.03149 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top