hi erik,
thanx for your interest. here the mapping file:
Code:
<hibernate-mapping default-cascade="none">
<class name="business.model.FormVersionImpl" table="FOXF02" dynamic-insert="false" dynamic-update="false">
<id name="formVersionId" type="long" unsaved-value="0">
<column name="ID_FODE" sql-type="BIGINT"/>
<generator class="increment">
</generator>
</id>
<property name="revision" type="long">
<column name="REVISION" not-null="true" unique="false" sql-type="BIGINT"/>
</property>
<property name="width" type="int">
<column name="FORMWIDTH" not-null="true" unique="false" sql-type="INTEGER"/>
</property>
<property name="CA_STATUS" type="int">
<column name="CA_STATUS" not-null="true" unique="false" sql-type="INTEGER"/>
</property>
<property name="status" type="short">
<column name="CO_STATUS" not-null="true" unique="false" sql-type="SMALLINT"/>
</property>
<property name="lockuser" type="java.lang.String">
<column name="LOCKUSER" not-null="true" unique="false" sql-type="VARCHAR(256)"/>
</property>
<property name="startDate" type="java.util.Date">
<column name="STARTDATE" not-null="true" unique="false" sql-type="DATE"/>
</property>
<property name="endDate" type="java.util.Date">
<column name="ENDDATE" not-null="true" unique="false" sql-type="DATE"/>
</property>
<property name="formId" type="long">
<column name="ID_FOTY" not-null="true" unique="false" sql-type="BIGINT"/>
</property>
<property name="spare" type="int">
<column name="SPARE" not-null="true" unique="false" sql-type="INTEGER"/>
</property>
<property name="textFont" type="java.lang.String">
<column name="TXTFONT" not-null="true" unique="false" sql-type="VARCHAR(256)"/>
</property>
<property name="refFont" type="java.lang.String">
<column name="REFFONT" not-null="true" unique="false" sql-type="VARCHAR(256)"/>
</property>
<property name="splitTop" type="int">
<column name="SPLITTOP" not-null="true" unique="false" sql-type="INTEGER"/>
</property>
<property name="splitLeft" type="int">
<column name="SPLITLEFT" not-null="true" unique="false" sql-type="INTEGER"/>
</property>
<property name="labelReferenceKey" type="long">
<column name="ID_POREKE" not-null="true" unique="false" sql-type="BIGINT"/>
</property>
<property name="sortNumber" type="int">
<column name="SORTNUMBER" not-null="true" unique="false" sql-type="INTEGER"/>
</property>
<property name="organizationUnit" type="java.lang.String">
<column name="ORGUNIT" not-null="true" unique="false" sql-type="VARCHAR(256)"/>
</property>
<property name="numberOfFreezedBlocksAtTop" type="int">
<column name="XFRZBLKTOP" not-null="true" unique="false" sql-type="INTEGER"/>
</property>
<property name="numberOfFreezedRowsInLastBlockTop" type="int">
<column name="XFRZCCTOP" not-null="true" unique="false" sql-type="INTEGER"/>
</property>
<property name="numberOfFreezedColumnsAtLeft" type="int">
<column name="XFRZCCLEFT" not-null="true" unique="false" sql-type="INTEGER"/>
</property>
<property name="createDate" type="java.sql.Timestamp">
<column name="CREATEDATE" not-null="true" unique="false" sql-type="TIMESTAMP"/>
</property>
<property name="createUser" type="java.lang.String">
<column name="CREATEUSER" not-null="true" unique="false" sql-type="VARCHAR(256)"/>
</property>
<property name="updateDate" type="java.util.Date">
<column name="updateDate" not-null="true" unique="false" sql-type="DATE"/>
</property>
<property name="CUser" type="java.lang.String">
<column name="CUSER" not-null="true" unique="false" sql-type="VARCHAR(256)"/>
</property>
<property name="CDate" type="java.sql.Timestamp">
<column name="CDATE" not-null="true" unique="false" sql-type="TIMESTAMP"/>
</property>
<property name="UUser" type="java.lang.String">
<column name="UUSER" not-null="true" unique="false" sql-type="VARCHAR(256)"/>
</property>
<property name="UDate" type="java.sql.Timestamp">
<column name="UDATE" not-null="true" unique="false" sql-type="TIMESTAMP"/>
</property>
<property name="updateUser" type="java.lang.String">
<column name="UPDATEUSER" not-null="true" unique="false" sql-type="VARCHAR(256)"/>
</property>
<set name="blockList" order-by="ID_FODE" lazy="true" fetch="select" inverse="true">
<key foreign-key="FOXF03_ID_FODEC">
<column name="ID_FODE" sql-type="BIGINT"/>
</key>
<one-to-many class="business.model.BlockImpl"/>
</set>
</class>
</hibernate-mapping>
... and the test code...
Code:
public void testCascadedCreateFormVersion()
{
FormVersion fullFormVersion = (FormVersion)getFullFormVersion();
HibernateUtil.beginnTransaction();
Session session = HibernateUtil.getSession();
session.save(fullFormVersion);
HibernateUtil.commitTransaction();
HibernateUtil.closeSession();
}
the method 'getFullFormVersion' returns a new created instance of 'FormVersionImpl'