title: hibernate findbyid causes update?
body: <p>I faced with a very strange behavior in my web app with spring 3 and hibernate-core 3.5.1-Final.</p>
  
  <p>For simplicity i provide  my code..</p>
  
  <pre><code>if(ripid!=null){ //Parameter
          Appuntamento apDaRip = appuntamentoService.findById(ripid);
  
          if(apDaRip.getIdpadre()!=null){
              apDaRip.setNota("RIPROGRAMMATO n."+ripid.toString()+"\n"+apDaRip.getNota());
              apDaRip.setIdpadre(apDaRip.getIdpadre());
          }else{              
              apDaRip.setNota("RIPROGRAMMATO n."+ripid.toString()+"\n"+apDaRip.getNota());
              apDaRip.setIdpadre(ripid);
          }
          try{
              apDaRip.setOrarioinizio(null);              
              apDaRip.setDurata(null);
              //apDaRip.setIdappuntamento(null);
  
  
          }catch(Exception e){e.printStackTrace();}
  
          map.put("appuntamento", apDaRip);
  
      }
  
      di = datiintranetService.findById(DatiintranetService.PASS_X_INTERVENTI);
      map.put("passinterventi", di.getBoolean()); 
  </code></pre>
  
  <p>The idea behind is to use some data of an object "Appuntamento" for produce a new one.
  So i'm going to change some value and before send the object to my view (jsp) i fetch other data by calling findbyid. This cause an update to the Appuntamento object... Off course i don't want this behavior. Someone can have an explanation of this?</p>
  
  <p><strong>Edit-1</strong></p>
  
  <p>Here's the Dao</p>
  
  <pre><code>@Transactional
  public class DatiintranetService {
  
      private DatiintranetDAO datiintranetDAO;
  
      public void setDatiintranetDAO(DatiintranetDAO datiintranetDAO) {
          this.datiintranetDAO = datiintranetDAO;
      }
  
      public DatiintranetDAO getDatiintranetDAO() {
          return datiintranetDAO;
      }
      public Datiintranet findById(Integer id) {
          return datiintranetDAO.findById(id);
      }
  }
  </code></pre>
  
  <p>and For Appuntamento class I provide to you a snapshot </p>
  
  <pre><code>@Entity
  @Table(name = "appuntamento", schema = "public")
  public class Appuntamento implements java.io.Serializable {
  
      @Id
      @SequenceGenerator(name="appuntamentoID", sequenceName="appuntamento_idappuntamento_seq",allocationSize =1)
      @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="appuntamentoID")   
      @Column(name = "idappuntamento", unique = true, nullable = false)
      public Integer getIdappuntamento() {
          return this.idappuntamento;
      }
  }
  </code></pre>
  
  <p><strong>Edit-2</strong>
  IF i move thoese two row above the if statement no update occur.</p>
  
  <pre><code>di = datiintranetService.findById(DatiintranetService.PASS_X_INTERVENTI);
  map.put("passinterventi", di.getBoolean());
  </code></pre>