Hi all,
I have the following xml files:
<hibernate-mapping>
<class name="com.diatem.src.Team" table="teams">
<id name="id" column="team_id" type="long" unsaved-value="0">
<generator class="sequence"/>
</id>
<property name="name" column="team_name" type="string" length="15" not-null="true"/>
<property name="city" column="city" type="string" length="15" not-null="true"/>
<set name="players" cascade="all" inverse="false" lazy="true">
<key column="team_id"/>
<one-to-many class="com.diatem.src.Player"/>
</set>
</class>
</hibernate-mapping>
and
<hibernate-mapping>
<class name="com.diatem.src.Player" table="players">
<id name="id" column="player_id" type="long" unsaved-value="0">
<generator class="sequence"/>
</id>
<property name="firstName" column="first_name" type="string" length="12" not-null="true"/>
<property name="lastName" column="last_name" type="string" length="15" not-null="true"/>
<property name="draftDate" column="draft_date" type="date"/>
<property name="annualSalary" column="salary" type="float"/>
<property name="jerseyNumber" column="jersey_number" type="integer" length="2" not-null="true"/>
<!--
<many-to-one name="team" class="com.diatem.src.Team" column="team_id"/>
-->
</class>
</hibernate-mapping>
when i try to save the Team object, only the first object from the players HashSet is inserted.
The Java sources I generate with Hibernate CodeGenerator.
Please help.
Thanks very much.
--steve
|