Dear fellow ojb users,
i faced a problem with ojb:
 if you have a class A with the id of the column which is autoincremented,
when you create a new object foo instance of A .
OJB insert all the column excepted the autoincremented one, then fetch in
the database the id of the newly stored object and set the Id in the
object.
When you insert an object with an id, OJB insert the object without the ID
specified so the id is not the same in the database and in the object
because in this case OJB don't fetch the new ID and don't update the
object.

With our DB2 z/OS database we are sometimes obliged to delete/insert object
instead of updating the object (it's mandatory when of the updated column
is a key of a partitionned table).
In this case we fetch our object from the database, delete it, update the
bean and store the object in the database. As it has been deleted OJB
realize that the object need to be inserted (and not updated) but doesn't
update the id of the java object.
In a 1 to N relation this side effect is harmless but if you have
inheritance in the database or a M to N relation then it's a big problem
because when you insert the whole relation there are foreign key violation
because of the difference of value between the bean and the database.

Is this problem easy to solve ?


Matthieu PATOU

DINQ/DSIN/SIDM/VNVO/VOIN
Téléphone 01 30 19 17 91  (29 17 91)


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

Reply via email to