Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3
Hey,
I got a quite problematic thing here, I have got 3 mappings, system, customer, systemtype.
To keep my database clean I used some foreign keys. After creating my mapping files I got stuck at my dao test.
Here is the top-part of my System.hbm.xml:
Code:
<composite-id name="id" class="itecon.bo.model.SystemId">
<key-property name="Scid" type="java.lang.Long">
<column name="SCID" scale="22" precision="0" not-null="true" sql-type="NUMBER" />
</key-property>
<key-property name="Ssystemtype" type="java.lang.Long">
<column name="SSYSTEMTYPE" scale="22" precision="0" not-null="true" sql-type="NUMBER" />
</key-property>
</composite-id>
<many-to-one name="Customer" class="itecon.bo.model.Customer" update="false" insert="false">
<column name="SCID" scale="22" precision="0" not-null="false" />
</many-to-one>
<many-to-one name="Systemtype" class="itecon.bo.model.Systemtype" update="false" insert="false">
<column name="SSYSTEMTYPE" scale="22" precision="0" not-null="false" />
</many-to-one>
<property name="Sid" type="java.lang.Long">
<column name="SID" scale="22" precision="0" not-null="true" unique="true" sql-type="NUMBER" />
</property>
As explained above, system references the primary keys of systemtype and customer, but my problem is, that Sid should be auto_incremental but <generator> is not allowed.
So my question is: Do I have an architectural problem, or are there any workaroungs to fix this?
I thank in advance for all tips and hints.
Regards Valentin