OJB looks for a value of 0.  If the id value is 0 and it is set to auto-increment then 
OJB will generate a value for it.  I ran into the same thing myself not to long ago.

-----Original Message-----
From: Brill Pappin [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 30, 2003 11:00 PM
To: OJB Users List
Subject: something not working as I expect it to


I have a fairly simple object, who's ID I need to access.

in my descriptor for the object, I have the id field set to auto-increment
and as a primary key.

In the class, the id is initialized to -1 (All my classes, in all my
libraries initialize all instance members, even if only to null. this is
part of our standards and good programming practice in general).

What I am expecting, is that because I've set the id to auto-increment in
the descriptor, that when I create a new class, the ID is auto generated...
however what I get is the default value of the new object (-1 in this case).
Can I force ID's for a particular object to always be generated by the
database?

If not, what is the recommended way to force that generation?

I need the ID's because I'm working in a web environment and the id's are
often called from remote applications... not to mention legacy data/apps ;)
So, I need the ID field, but I also want the system to generate it for new
objects.

- Brill Pappin



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to