Hi all,
I'm new to Hibernate and is trying to implement the simple 1-to-N relations. I'm ok with the N-to-1 part but trapped in the one-to-many tag.
whenever i uncomment the following code, I'll get:
javax.servlet.ServletException: duplicate import: Parent
Code:
<hibernate-mapping>
<class name="eg.Parent" table="parent">
<id name="pid" type="int" unsaved-value="null" >
<column name="pid" sql-type="int" not-null="true"/>
</id>
<property name="name">
<column name="NAME" sql-type="varchar(10)" not-null="true"/>
</property>
<!-- cause duplicate import: Parent
<set name="children" inverse="true" lazy="true">
<key column="parent_pid"/>
<one-to-many class="eq.Child"/>
</set>
-->
</class>
<class name="eg.Child" table="child">
<id name="cid" type="int" unsaved-value="null" >
<column name="cid" sql-type="int" not-null="true"/>
</id>
<property name="name">
<column name="NAME" sql-type="varchar(10)" not-null="true"/>
</property>
<many-to-one name="parent" column="parent_pid" class="eg.Parent"/>
</class>
</hibernate-mapping>
What mistake did I make?
Thx in advance.