posted 19 years ago
Hi,
I have the problem that after i make a new object persistence with ojb, it is twice in one of my tables.
My Classes look like that:
Animal<-Cat
The reference_user.xml look like this:
<class-descriptor
class="ojb.test.Animal"
table="animal"
>
<field-descriptor
name="id"
column="Id"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="race"
column="Race"
jdbc-type="VARCHAR"
/>
</class-descriptor>
<class-descriptor
class="ojb.test.Cat"
table="cats"
>
<field-descriptor
name="id"
column="ID"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="name"
column="Name"
jdbc-type="VARCHAR"
/>
<reference-descriptor name="super"
class-ref="ojb.test.Animal"
auto-retrieve="true"
auto-update="true"
auto-delete="true"
>
<foreignkey field-ref="id"/>
</reference-descriptor>
</class-descriptor>
And my table schema like this:
CREATE TABLE `animal` (
`Id` int(10) unsigned NOT NULL auto_increment,
`Race` varchar(25) default NULL,
PRIMARY KEY (`Id`)
) TYPE=MyISAM;
CREATE TABLE `cats` (
`Id` int(1) unsigned NOT NULL auto_increment,
`Name` varchar(25) default NULL,
PRIMARY KEY (`Id`)
) TYPE=MyISAM ROW_FORMAT=DYNAMIC;
After i insert a cat object i have one entry in table cats (that is correct) and two entries in the table animal. One of the two entries belongs to the cat table entry the other one has a new id.
I use OJB 1.0.1, jdk1.4.2_3, mysql-connector-java-3.0.9-stable.
Thanks for help,
Tom