-----Original Message-----
From: Bram Meijboom 
Sent: Friday, July 04, 2003 3:55 PM
To: '[EMAIL PROTECTED]'
Subject: auto increment and 0 question


Hi,

Im currently working on a project using an existing database and am writing
a new Api 
to access the database using OJB and have the following problem.

In my database there are rescords with the value 0 for colomns that
"auto-increment" 
and ojb is "recognizing" the materialized objects of theose records as new
objects, eg

an record with id=0, name="bram" is materialized as Test(0, "bram) and when
i store it with OJB
it is assigned a new "incremented" id.

I have looked thru the OJB code and found that 
BrokerHelper.getAutoIncrementValue(FieldDescriptor fd, Object obj, Object
cv)
does the testing of the object if it "needs" an new id.

What i want to ask is if i change line 
297     if ((cv == null) || ((cv instanceof Number) && (((Number)
cv).intValue() == 0)))

to 
297     if (cv == null)

am i missing something or is my assumption correct that only
Object members (no primitive types like int, char, long) like Integer, Long
that are null are assigned a new value.




Bram



table TEST (
        ID NUMBER(10) not null primary key,
        NAME NUMBER(10) not null
)

public class Test {
        Integer id; 
        String name;
                  
        public Test() {}
        public Integer getId() { return this.id;}
        public void setName(String name) { this.name = name; }
        public String getName() { return this.name ;}
}

<class-descriptor class="Test" table="test">
      <field-descriptor id="1" name="id" column="ID" jdbc-type="INTEGER"
primarykey="true" autoincrement="true" />
        <field-descriptor id="2" name="name" column="NAME"
jdbc-type="VARCHAR" nullable="false" lengthe="255"/>
</class-descriptor>







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

Reply via email to