I have defined the following mapping:
<?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
package="com.libertyit.bmit.cco.jaxb.impl">
<class name="AccountImpl" table="account">
<id name="stakeholderID" column="StakeholderID" type="int" unsaved-value="any">
<generator class="assigned"/>
</id>
<property name="accountNumber" column="AccountNumber" type="string" length="255"/>
....
....
<component name="address" class="com.libertyit.bmit.cco.jaxb.impl.AddressImpl">
<many-to-one name="addressID" class="com.libertyit.bmit.cco.jaxb.impl.AddressImpl" column="AddressID" unique="true"/>
</component>
</class>
</hibernate-mapping>
The AccountImpl object contains a method named getAddress().
The AddressImpl object contains a method named getAddressID().
Each account has one address and each address can belong to one or more accounts.
My mapping for the AddressImpl object is as follows:
<?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
package="com.libertyit.bmit.cco.jaxb.impl">
<class name="AddressImpl" table="address">
<id name="addressID" column="AddressID" type="int" unsaved-value="any">
<generator class="native"/>
</id>
<property name="attnOf" column="AttnOf" type="string" length="255"/>
....
....
</class>
</hibernate-mapping>
I generated my database schema using the mapping classes shown above. I have a test script which attempts to save the AccountImpl object and consequently, tries to save the AddressImpl object. However, I am getting the following Exception:
net.sf.hibernate.MappingException: No persister for: java.lang.Integer
Any ideas as to why this is happening.
Thanks,
Simon.
|