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 Lars Soltau <la...@slab.de> on 2003/03/28 15:20:21 UTC

primary key initialisation

I am sorry if this has already been answered on this list, but the list 
archives are offline and I am kinda in a hurry.

In the tutorial it says:

----8<----
On storing of newProduct OJB detects that the attribute is not properly 
set and assigns a unique id.
----8<----

How does OJB determine if a primary key attribute "is not properly set" 
if it is an primitive type (as in int) and not an object type? Should I 
initialise the PK attribute to any special value (0, -1, whatever) in 
the constructor?

Greetings
Lars Soltau

Re: primary key initialisation

Posted by Thomas Mahler <th...@web.de>.
Set the values to 0.

Lars Soltau wrote:
> I am sorry if this has already been answered on this list, but the list 
> archives are offline and I am kinda in a hurry.
> 
> In the tutorial it says:
> 
> ----8<----
> On storing of newProduct OJB detects that the attribute is not properly 
> set and assigns a unique id.
> ----8<----
> 
> How does OJB determine if a primary key attribute "is not properly set" 
> if it is an primitive type (as in int) and not an object type? Should I 
> initialise the PK attribute to any special value (0, -1, whatever) in 
> the constructor?
> 
> Greetings
> Lars Soltau