ojb-user@db.apache.org
[Top] [All Lists]

RE: Is not allowed to use "0" in an INTEGER filed that is part of a prim

Subject: RE: Is not allowed to use "0" in an INTEGER filed that is part of a primary key?
From: "Hiller, Frank RD-PT31"
Date: Wed, 9 Jan 2008 16:38:08 +0100
Hi Danilo,

thank you, I'll try.
In the meantime I used
conversion="org.apache.ojb.broker.accesslayer.conversions.Int2IntegerFie
ldConversion" but without effect.

Thanks again........Frank

-----Original Message-----
From: Danilo Tommasina [mailto:dtommasina@xxxxxxxxxxx] 
Sent: Wednesday, January 09, 2008 4:24 PM
To: OJB Users List
Subject: Re: Is not allowed to use "0" in an INTEGER filed that is part
of a primary key?

Hi Frank,

if you are using a primitive 'int' in your java class, int 0 is
considered as NULL and interpreted as 'undefined' primary key which will
cause an insert instead of an update.
you can use a (java.lang.)Integer in your class.

hopefully this helps you further
danilo

Hiller, Frank RD-PT31 wrote:
> Hi all,
> 
> I'm using OJB 1.0.3.
> I defined a primary key in respository descriptor consisting of three 
> fields.
> Two fields are "VARCHAR", one is "INTEGER".
> 
> When I try to insert multiple objects with identical values in the 
> VARCHAR fields and a value of "0" in the INTEGER field, then multiple 
> records are inserted into database.
> Using a value > 0 for the INTEGER field inserts only one record, which

> is correct (other records are rejected).
> 
> So it seems to me that is not allowed to use "0" in an INTEGER filed 
> that is part of a primary key. Am I right?
> 
> Thanks................Frank
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@xxxxxxxxxxxxx
For additional commands, e-mail: ojb-user-help@xxxxxxxxxxxxx


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@xxxxxxxxxxxxx
For additional commands, e-mail: ojb-user-help@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>