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:
<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.
Bye Johannes
-
Hibernate Mapping Problem with Relationsships (1 messages)
- Posted by: Johannes Hiemer
- Posted on: May 25 2005 05:54 EDT
Threaded Messages (1)
- Hibernate Mapping Problem with Relationsships by Matthew Wilson on May 25 2005 07:33 EDT
-
Hibernate Mapping Problem with Relationsships[ Go to top ]
- Posted by: Matthew Wilson
- Posted on: May 25 2005 07:33 EDT
- in response to Johannes Hiemer
You will get better support at the hibernate forums:)
Hibernate does not like composit keys. You will run into more difficulties if you use them. In this case they are not needed.