Hi
i've two tables..
table1 has primary key [id_1]
table2 has foreign key [id_1] and a composite primary key [id_1, id2]
when using hibernate save() on table1, the id_1 generated {using increment strategy} isn't cascading to table2 and i am getting a null exception.
here are mappings i've used in code:
table1Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="classA" table="TABLE1">
<id name="Id" column="ID" type="java.math.BigInteger">
<generator class="sequence">
<param name="sequence">seqGen</param>
</generator>
</id>
<property name="anyText" column="SOME_TEXT" type="string"/>
<bag name="ClassB" inverse="true" cascade="all" >
<key column="ID"/>
<one-to-many class="ClassB"/>
</bag>
</class>
</hibernate-mapping>
table2
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="ClassB" table="TABLE2">
<composite-id >
<key-property name="Id" access="field" column="ID"/>
<key-property name="Id2" access="field" column="ID2" />
</composite-id>
</class>
</hibernate-mapping>
what could be the problem with this?...am using DB2..
much thanks!!