You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by "Martin I. Levi" <ml...@labtie.mmt.upc.es> on 2004/10/08 16:01:07 UTC

JDBC Types... Primitive or Objects?

Hi!

The JDBC 3.0 specification says that some JDBC types should be mapped to
primitive types like:

JDBC         Java
BOOLEAN ---> boolean
INTEGER ---> int

etc... my ojb mappings should always follow this rules or could I use? 

JDBC         Java
BOOLEAN ---> Boolean
INTEGER ---> Integer
etc.

Which is the best option if there is any?

Notes:
*I'm not talking about PKs and FKs I know those should be mapped to
Integer.
*I would like to know the default OJB's behaviour i know I could
implement a field conversion.

Thanks!

-- 
Saludos,

Martin I. Levi

Centre Tecnològic de Transferenciència de Calor
Universitat Politècnica de Catalunya
www.cttc.upc.edu


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: JDBC Types... Primitive or Objects?

Posted by WHIRLYCOTT <ph...@whirlycott.com>.
Martin I. Levi wrote:

>>I think objects is the best option because if the row is null, the 
>>object is null.

I strongly agree with this sentiment.  I used to use another O/R mapper 
and had a series of problems when I discovered that my beans that had 
primitive fields (such as int, etc.) weren't happily cooperating when I 
was yanking objects out of the system.

I would definitely recommend using objects vs primitive fields except in 
those cases where you can account for the difference between null and 0 
in your code.

phil.

-- 
                                   Whirlycott
                                   Philip Jacob
                                   phil@whirlycott.com
                                   http://www.whirlycott.com/phil/

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: JDBC Types... Primitive or Objects?

Posted by Thomas Franke <fr...@mhr.de>.
Martin I. Levi wrote:


>>I think objects is the best option because if the row is null, the 
>>object is null.
> 
> 
> Ok, but why the JDBC spec doesn't say the same?
> 
I use ojb like a black box. I can't say what ojb do. But I can say it
works good. :)

-- 
Mit freundlichen Grüßen

Thomas Franke

Projektleiter WIS-Projekt
----------------------------
Wissen Innovation Sicherheit
----------------------------
MedienHaus Rostock GmbH
Platz der Freundschaft 1
18059 Rostock
----------------------------
fon: +49 381 40 587 535
fax: +49 381 40 587 552
mobil: +49 1715222015

http://www.mhr.de/wis
mail: wis-info@mhr.de
----------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: JDBC Types... Primitive or Objects?

Posted by Thomas Franke <th...@bigdolphin.de>.
Martin I. Levi wrote:


>>I think objects is the best option because if the row is null, the 
>>object is null.
> 
> 
> Ok, but why the JDBC spec doesn't say the same?
> 
I use ojb like a black box. I can't say what ojb do. But I can say it 
works good. :)

-- 
Mit freundlichen Grüßen

Thomas Franke
__

Thomas Franke
Softwareentwickler
Wiesenweg 10
18334 Kölzow

Tel.: 038228 61886
Mobil: 01629803488


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: JDBC Types... Primitive or Objects?

Posted by "Martin I. Levi" <ml...@labtie.mmt.upc.es>.
On Fri, 2004-10-08 at 17:11, Thomas Franke wrote:
> Martin I. Levi wrote:
> 
> > JDBC         Java
> > BOOLEAN ---> Boolean
> > INTEGER ---> Integer
> In our project we use this without any problems.
> 
> > Which is the best option if there is any?
> I think objects is the best option because if the row is null, the 
> object is null.

Ok, but why the JDBC spec doesn't say the same?

-- 
Saludos,

Martin I. Levi

Centre Tecnològic de Transferenciència de Calor
Universitat Politècnica de Catalunya
www.cttc.upc.edu


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: JDBC Types... Primitive or Objects?

Posted by Thomas Franke <fr...@mhr.de>.
Martin I. Levi wrote:

> JDBC         Java
> BOOLEAN ---> Boolean
> INTEGER ---> Integer
In our project we use this without any problems.

> Which is the best option if there is any?
I think objects is the best option because if the row is null, the 
object is null.

-- 
Mit freundlichen Grüßen

Thomas Franke

Projektleiter WIS-Projekt
----------------------------
Wissen Innovation Sicherheit
----------------------------
MedienHaus Rostock GmbH
Platz der Freundschaft 1
18059 Rostock
----------------------------
fon: +49 381 40 587 535
fax: +49 381 40 587 552
mobil: +49 1715222015

http://www.mhr.de/wis
mail: wis-info@mhr.de
----------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org