Hello,
I have a problem with this Code:
Code:
Teil teil = (Teil) session.get(Teil.class, teilId);
HibernateUtil.commitTransaction();
HibernateUtil.closeSession();
Every Time I want to get a Teil from the database, Hibernate insert the values of the value collection "reichweite". The first run, one line is inserted. The second run two lines, the third 4 lines, the fourth 8 lines and so on.
I have spent one day to find something in this forum and with google. But nothing really works.
I hope someone can help me. Thx.
bande
This is done by Hibernate:
Hibernate: delete from teil_reichweite where reichweite_teil_id=? and bestandsreichweite=? and norm_rw_ist=? and norm_rw_max=? and norm_rw_min=? and norm_rw_soll=? and ampelstatus=?
Hibernate: insert into teil_reichweite (reichweite_teil_id, bestandsreichweite, norm_rw_ist, norm_rw_max, norm_rw_min, norm_rw_soll, ampelstatus) values (?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into teil_reichweite (reichweite_teil_id, bestandsreichweite, norm_rw_ist, norm_rw_max, norm_rw_min, norm_rw_soll, ampelstatus) values (?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into teil_reichweite (reichweite_teil_id, bestandsreichweite, norm_rw_ist, norm_rw_max, norm_rw_min, norm_rw_soll, ampelstatus) values (?, ?, ?, ?, ?, ?, ?)Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="model">
<class name="Teil" table="teil" optimistic-lock="none">
<id name="teilId" type="long" unsaved-value="null" column="teil_id">
<generator class="native"/>
</id>
<property name="mengeneinheit" type="string" column="mengeneinheit"/>
...
<set name="reichweite" table="teil_reichweite" cascade="none" lazy="false">
<key foreign-key="reichweite_teilId" column="reichweite_teil_id" unique="true"/>
<composite-element class="model.Reichweite">
<property name="bestandsreichweite" type="integer" column="bestandsreichweite"/>
<property name="normRwIst" type="double" column="norm_rw_ist"/>
<property name="normRwMax" type="double" column="norm_rw_max"/>
<property name="normRwMin" type="double" column="norm_rw_min"/>
<property name="normRwSoll" type="double" column="norm_rw_soll"/>
<property name="ampelstatus" type="string" column="ampelstatus"/>
</composite-element>
</set>
...
</class>
</hibernate-mapping>
Hibernate version: 3.0.5
Name and version of the database you are using:MySQL