-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: value collections are inserted with get()-method
PostPosted: Tue Nov 15, 2005 10:27 am 
Newbie

Joined: Thu Oct 20, 2005 5:25 am
Posts: 14
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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 15, 2005 12:04 pm 
Beginner
Beginner

Joined: Tue Sep 23, 2003 10:03 am
Posts: 26
Location: madison, wi
What do your getters and setters for reichweite look like?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 15, 2005 12:07 pm 
Newbie

Joined: Thu Oct 20, 2005 5:25 am
Posts: 14
here they are:

Code:
public Integer getBestandsreichweite() {
        return this.bestandsreichweite;
    }
   

    public void setBestandsreichweite(Integer bestandsreichweite) {
        this.bestandsreichweite = bestandsreichweite;
    }
   


    public Double getNormRwIst() {
        return this.normRwIst;
    }
   

    public void setNormRwIst(Double normRwIst) {
        this.normRwIst = normRwIst;
    }
   

    public Double getNormRwMax() {
        return this.normRwMax;
    }
   

    public void setNormRwMax(Double normRwMax) {
        this.normRwMax = normRwMax;
    }
   

    public Double getNormRwMin() {
        return this.normRwMin;
    }
   

    public void setNormRwMin(Double normRwMin) {
        this.normRwMin = normRwMin;
    }
   

    public Double getNormRwSoll() {
        return this.normRwSoll;
    }
   

    public void setNormRwSoll(Double normRwSoll) {
        this.normRwSoll = normRwSoll;
    }
   

    public String getAmpelstatus() {
        return this.ampelstatus;
    }
   

    public void setAmpelstatus(String ampelstatus) {
        this.ampelstatus = ampelstatus;
    }


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.