db-ojb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Markus.Lau...@bedag.ch>
Subject Problem with Inheritance and autoincrement=false
Date Thu, 09 Jun 2005 09:45:46 GMT
Hi

We use inheritance Mapping as described in
http://db.apache.org/ojb/docu/guides/advanced-technique.html#Mapping+Cla
sses+on+Multiple+Joined+Tables
So ClassB inhertits from ClassA. The only difference i see to the
example is that my classB doesn't have a field id because it inherits
ist from classA.

It is mapped in the the following way in class B:

<reference-descriptor name="super"
class-ref="ClassA"
auto-retrieve="true" auto-update="true" auto-delete="true">
<foreignkey field-ref="id" /> 
</reference-descriptor>

With autoincrement=true this works fine. The Id is automatically created
and the classB stored on two tables.
For migrating from an older system we now have to set the id manually,
so we set autoincrement=false for both classes.
The result is, that the Record in TableB is inserted correctly but when
storing the Record in TableA the ID is null, so a sql exception is
thrown because the primary key must not be null.

Does anyone have a solution for this?

Thanks, Markus


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message