Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.1.0 (Hibernate Tools 3.1.0 beta1)
Mapping documents:
Code:
<class name="Resurs" table="RESURS">
<id name="id" column="RESURSID">
<generator class="identity">
</generator>
</id>
<many-to-one name="typ" class="Resurstyp" property-ref="typ" foreign-key="FK_RESURSRESURSTYP">
<column name="RESURSTYP" length="50" not-null="true"/>
</many-to-one>
<property name="beteckning">
<column name="BETECKNING" length="50" not-null="true"/>
</property>
<set name="resurser" table="RELRESURS">
<key column="RESURSID1" not-null="true" foreign-key="FK_RELRESURSID1"/>
<composite-element class="RelResurs">
<parent name="resursid1"/>
<many-to-one name="resursid2" column="RESURSID2" not-null="true" class="Resurs" foreign-key="FK_RELRESURSID2"/>
<property name="fromdatum" length="50" not-null="true"/>
<property name="tomdatum" length="50"/>
</composite-element>
</set>
</class>
Name and version of the database you are using: MySql 5.0.13Running the mapping document above through the HibernateToolTask to generate Java POJO classes I expected that the parent element would result in a property named "resursid1" of type "Resurs" in the resulting "RelResurs" class. But the setter/getter methods are never writen which causes the following exception to be thrown:
Code:
Caused by: org.hibernate.PropertyNotFoundException: Could not find a setter for property resursid1 in class RelResurs
How can composite-element classes be used if they don't mirror the columns in the underlying table?