You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Brian Schlining <br...@mbari.org> on 2005/11/07 23:17:14 UTC
[JDO] bit/boolean in apache derby
Hi All,
I'm porting an application from SQL Server to Apache Derby. The
application uses a table that contains a bit column to store a
boolean type value (0 = false, 1 = true). I've looked through the
Derby documentation available at http://db.apache.org/derby/docs/10.1/
ref/ and there's not a bit data type in Derby. Any recommendations on
what I should be using in Derby to map bit values?
A little more background:
My application uses an O/R mapping layer (Castor, http://
www.castor.org) and is meant to be portable across databases, (i.e it
should run on SQL Server, Derby and others without having to modify
code or mapping files.). The application is also being used in a
production environment so changing the bit field on SQL server to
something else isn't really a good option for me. The offending
tables T-SQL is:
CREATE TABLE [dbo].[Media] (
[id] bigint NOT NULL,
[ConceptDelegateID_FK] bigint NULL,
[MediaFileName] varchar(1024) NULL,
[MediaType] char(5) NULL,
[PrimaryMedia] bit NULL DEFAULT (0),
[Credit] varchar(255) NULL,
[Caption] varchar(1000) NULL,
CONSTRAINT [PK_Media] PRIMARY KEY([id])
)
GO
BTW, the application in question can be found at http://
vars.sourceforge.net
Cheers
B
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Brian Schlining
MBARI
Software Engineer
brian@mbari.org
(831)775-1855
http://www.mbari.org/staff/brian
Re: [JDO] bit/boolean in apache derby
Posted by Rick Hillegas <Ri...@Sun.COM>.
I hope to pick up enhancement 499 as part of my 10.2 work.
Regards,
-Rick
Satheesh Bandaram wrote:
>Derby doesn't support Boolean data type, much like Oracle or DB2. There
>is a New Feature request already logged:
>http://issues.apache.org/jira/browse/DERBY-499
>
>I would consider using char(1) or smallint as an alternative...
>
>Satheesh
>
>Brian Schlining wrote:
>
>
>
>>Hi All,
>>
>>I'm porting an application from SQL Server to Apache Derby. The
>>application uses a table that contains a bit column to store a
>>boolean type value (0 = false, 1 = true). I've looked through the
>>Derby documentation available at http://db.apache.org/derby/docs/10.1/
>>ref/ and there's not a bit data type in Derby. Any recommendations on
>>what I should be using in Derby to map bit values?
>>
>>A little more background:
>> My application uses an O/R mapping layer (Castor, http://
>>www.castor.org) and is meant to be portable across databases, (i.e it
>>should run on SQL Server, Derby and others without having to modify
>>code or mapping files.). The application is also being used in a
>>production environment so changing the bit field on SQL server to
>>something else isn't really a good option for me. The offending
>>tables T-SQL is:
>>
>>CREATE TABLE [dbo].[Media] (
>> [id] bigint NOT NULL,
>> [ConceptDelegateID_FK] bigint NULL,
>> [MediaFileName] varchar(1024) NULL,
>> [MediaType] char(5) NULL,
>> [PrimaryMedia] bit NULL DEFAULT (0),
>> [Credit] varchar(255) NULL,
>> [Caption] varchar(1000) NULL,
>> CONSTRAINT [PK_Media] PRIMARY KEY([id])
>>)
>>GO
>>
>>BTW, the application in question can be found at http://
>>vars.sourceforge.net
>>
>>Cheers
>>B
>>~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
>>Brian Schlining
>>MBARI
>>Software Engineer
>>brian@mbari.org
>>(831)775-1855
>>http://www.mbari.org/staff/brian
>>
>>
>>
>>
>>
>
>
>
Re: [JDO] bit/boolean in apache derby
Posted by Satheesh Bandaram <sa...@Sourcery.Org>.
Derby doesn't support Boolean data type, much like Oracle or DB2. There
is a New Feature request already logged:
http://issues.apache.org/jira/browse/DERBY-499
I would consider using char(1) or smallint as an alternative...
Satheesh
Brian Schlining wrote:
> Hi All,
>
> I'm porting an application from SQL Server to Apache Derby. The
> application uses a table that contains a bit column to store a
> boolean type value (0 = false, 1 = true). I've looked through the
> Derby documentation available at http://db.apache.org/derby/docs/10.1/
> ref/ and there's not a bit data type in Derby. Any recommendations on
> what I should be using in Derby to map bit values?
>
> A little more background:
> My application uses an O/R mapping layer (Castor, http://
> www.castor.org) and is meant to be portable across databases, (i.e it
> should run on SQL Server, Derby and others without having to modify
> code or mapping files.). The application is also being used in a
> production environment so changing the bit field on SQL server to
> something else isn't really a good option for me. The offending
> tables T-SQL is:
>
> CREATE TABLE [dbo].[Media] (
> [id] bigint NOT NULL,
> [ConceptDelegateID_FK] bigint NULL,
> [MediaFileName] varchar(1024) NULL,
> [MediaType] char(5) NULL,
> [PrimaryMedia] bit NULL DEFAULT (0),
> [Credit] varchar(255) NULL,
> [Caption] varchar(1000) NULL,
> CONSTRAINT [PK_Media] PRIMARY KEY([id])
> )
> GO
>
> BTW, the application in question can be found at http://
> vars.sourceforge.net
>
> Cheers
> B
> ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
> Brian Schlining
> MBARI
> Software Engineer
> brian@mbari.org
> (831)775-1855
> http://www.mbari.org/staff/brian
>
>
>