Hibernate version: 2.1.2
Database : DB2 v8.1
There is a one-to-one mapping between my two classes,SubFoo and Bar.
----------------------------
Mapping is:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="Foo" table="foo">
<id column="ID" name="id" type="long">
<generator class="identity"></generator>
</id>
<subclass name="SubFoo" discriminator-value="subfoo">
<one-to-one name="bar" class="Bar" constrained="true" cascade="all"/>
</subclass>
</class>
<class name="Bar" table="Bar">
<id column="ID" name="id" type="long">
<generator class="foreign">
<param name="property">Bar</param>
</generator>
</class>
</hibernate-mapping>
--------------------------------
Related class :
Bar bar = new Bar();
SubFoo subfoo = new SubFoo();
subfoo.setBar(bar);
sess.save(subfoo);
---------------------------------------
While I'm persisting SubFoo bean, I take an exception as
HibernateException("unmapped property: " + propertyName); in net.sf.hibernate.persister.AbstractEntityPersister.
I looked at the example in Hibernate Users FAQ. But I couldn't solve the problem. Thanks for your interest.
|