Hibernate version:
3.0
Mapping documents:
ActResEmploy:
Code:
<class table="ACT_RES_EMPLOY" name="ActResEmploy" discriminator-value="NOS">
<meta attribute="class-description" inherit="false">@hibernate.class table="ACT_RES_EMPLOY"</meta>
<!-- Not sure whether that will work (in combination with one-to-one relation at the bottom) -->
<id>
<column name="ACT_RES_IX" sql-type="long"/>
<column name="ACT_ID" sql-type="long"/>
<generator class="foreign">
<param name="property">actRes</param>
</generator>
</id>
<!-- Associations -->
<one-to-one name="actRes" class="ActRes" outer-join="auto" constrained="true" property-ref="ActResCompositeKey">
<meta attribute="field-description">@hibernate.one-to-one class="ActRes" outer-join="auto" constrained="true"</meta>
</one-to-one>
</class>
ActRes:Code:
<class table="ACT_RES" name="ActRes" >
<meta attribute="class-description" inherit="false">@hibernate.class table="ACT_RES"</meta>
<id name="actResIx" type="long" column="ACT_RES_IX" length="15">
<meta attribute="field-description">@hibernate.id generator-class="GH4IdGenerator" type="long" column="ACT_RES_IX" length="15"</meta>
<generator class="GH4IdGenerator">
<param name="sequence">act_res_index_seq</param>
<param name="GH4IdType">Prefix</param>
</generator>
</id>
<properties name="ActResCompositeKey" unique="true" insert="false" update="false">
<property name="actResIx" type="java.lang.Long" column="ACT_RES_IX" length="15" insert="false" update="false">
<meta attribute="field-description">@hibernate.property column="ACT_RES_IX" length="15"</meta>
</property>
<property name="actId" type="java.lang.Long" column="ACT_ID" length="15" insert="false" update="false">
<meta attribute="field-description">@hibernate.property column="ACT_ID" length="15"</meta>
</property>
</properties>
<!-- Associations -->
<!-- derived association(s) for compound key -->
<!-- bi-directional many-to-one association to Act -->
<many-to-one name="act" class="Act" update="true" insert="true">
<meta attribute="field-description">@hibernate.many-to-one update="true" insert="true"</meta>
<meta attribute="field-description">@hibernate.column name="ACT_ID"</meta>
<column name="ACT_ID" />
</many-to-one>
<!-- end of derived association(s) -->
<!-- bi-directional one-to-one association to ActResEmploy -->
<one-to-one name="actResEmploy" class="ActResEmploy" outer-join="auto" property-ref="ActResCompositeKey">
<meta attribute="field-description">@hibernate.one-to-one outer-join="auto"</meta>
</one-to-one>
</class>
Full stack trace of any exception that occurs:Code:
java.lang.ExceptionInInitializerError
at util.HibernateConnectionSingleton.<clinit>(HibernateConnectionSingleton.java:31)
at test.Example.init(Example.java:36)
at test.Example.<init>(Example.java:32)
at test.Example.main(Example.java:193)
Caused by: org.hibernate.MappingException: Error reading resource: ActResEmploy.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:447)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1381)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1353)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1335)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1302)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1230)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1216)
at c2iedm.hibernate.util.HibernateConnectionSingleton.<clinit>(HibernateConnectionSingleton.java:28)
... 3 more
Caused by: org.hibernate.MappingException: must specify an identifier type: ActResEmploy
at org.hibernate.cfg.HbmBinder.bindSimpleId(HbmBinder.java:352)
at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:291)
at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:233)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:149)
at org.hibernate.cfg.Configuration.add(Configuration.java:358)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:395)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:444)
... 10 more
Exception in thread "main"
Name and version of the database you are using:
Oracle 9i
The generated SQL (show_sql=true):
didn't get so far...
What am I supposed to do? Is it possible at all to use a composite property as foreign identifier? I haven't found anything explicit about that, but also no examples...
I hope somebody can help me with that - I'm pretty much stuck!