Re: Different behaviour of SequenceManager in rc5 and 1.0.1

Armin Waibel <[email protected]> Sat, 29 Sep 2007 14:20:36 +0200
Newsgroups gmane.comp.jakarta.ojb.user
Message-ID <[email protected]>
Christian Eugster wrote:
> Hi Armin,
> 
> DBResult is useless (an older story). The object is written to the
> database (a mysql 5.0 database). But the primary key always the value
> '0'. When I change back to version 1.0.rc5 the values are assigned.
>

I checked the source in OJB 1.0.4, the PK will be assigned on insert of 
the object (if the PK field value is 'NULL': 0 for primitiv field (int 
long,...), 'Null' for non-primitiv).
See this class (scroll to the end):
http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/JdbcAccessImpl.java?revision=365204&view=markup

Are the PK fields initialized with non-Null values?
When do you request the PK value of your object? Is it definitely after 
insert of the object?

regards,
Armin

> Regards
> 
> Christian
>