Beginner |
![Beginner Beginner](./images/ranks/beginner.gif) |
Joined: Wed Feb 23, 2005 2:23 pm Posts: 21 Location: Pescara, italy
|
Hibernate version:
3.0.3
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="beans.Gebaeude" table="GEBAEUDE">
<id name="id" type="string" >
<column name="GEBAEUDE_ID" sql-type="int UNSIGNED"/>
<generator class="identity"/>
</id>
[...]
<joined-subclass name="beans.InProgressGebaeude" table="INPROGRESSGEBAEUDE">
<key column="GEBAEUDE_ID"/>
<property name="inProgressTyp" type="string">
<column name="INPROGRESSTYP" sql-type="varchar(25)"/>
</property>
<set name="buildRessource" lazy="true" inverse="true" cascade="all, delete-orphan">
<key column="GEBAEUDE_ID"/>
<one-to-many class="beans.Ressource"/>
</set>
[...]
</joined-subclass>
</class>
</hibernate-mapping>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="beans.Ressource" table="RESSOURCE">
<id name="id" type="string" >
<column name="RESSOURCE_ID" sql-type="int UNSIGNED"/>
<generator class="identity"/>
</id>
<many-to-one name="gebaeude" class="beans.Gebaeude" column="GEBAEUDE_ID"/>
<many-to-one name="inProgressGebaeude" class="beans.InProgressGebaeude" column="GEBAEUDEINPROGRESS_ID"/>
</class>
</hibernate-mapping>
Name and version of the database you are using:
MySQL
Debug level Hibernate log excerpt:
Hi,
I have here two Collections that are mixed up.
I have a Class beans.Gebaeude and a subclass of Gebaeude named beans.InProgressGebaeude.
Gebaeude and InProgressGebaeude both define a SET of beans.Ressource.
One is named ressource, the other buildRessource.
beans.InProgressGebaeude therefor has two different SETs of that both contain instances of the class beans.Ressource.
These two sets are mixed up in my application.
Problem;
If I add a Ressource to the SET buildRessource it is persisted as a member of the other SET!
The strange thing is that if the other SET ressource does not exist in the DB persisting buildRessource works fine!
Is that a mapping error of mine?
Thanx
Kai
!
|
|