0 Replies Latest reply on May 5, 2008 6:55 PM by sanghakanwar

    Update not working

    sanghakanwar

      Hi,


      I used the seam-gen to reverse engineer a db table. It generated the Entity bean and i was able to deploy the application. All the functionalities (create,delete,list) are working fine BUT the update does not work.


      Also, the generated code for edit page shows the following -



       |<s:decorate id="speciesDecoration" template="layout/edit.xhtml">
                      <ui:define name="label">species</ui:define>
                      <h:inputText id="species" 
                             disabled="#{petHome.managed}"
                                size="20"
                           maxlength="20"
                               value="#{petHome.instance.id.species}">
                          <a:support event="onblur" reRender="speciesDecoration" bypassUpdates="true" ajaxSingle="true"/>
                      </h:inputText>
                  </s:decorate>|





      Question - why does it show disabled in generated code ?
      Also even after removing it, the db is never updated.



      Entity class -



      package org.domain.SeamProject.entity;
      
      // Generated 5 May, 2008 1:25:14 PM by Hibernate Tools 3.2.1.GA
      
      import javax.persistence.AttributeOverride;
      import javax.persistence.AttributeOverrides;
      import javax.persistence.Column;
      import javax.persistence.EmbeddedId;
      import javax.persistence.Entity;
      import javax.persistence.Table;
      
      /**
       * Pet generated by hbm2java
       */
      @Entity
      @Table(name = "pet", catalog = "test")
      public class Pet implements java.io.Serializable {
      
              private PetId id;
      
              public Pet() {
              }
      
              public Pet(PetId id) {
                      this.id = id;
              }
      
              @EmbeddedId
              @AttributeOverrides( {
                              @AttributeOverride(name = "name", column = @Column(name = "name", length = 20)),
                              @AttributeOverride(name = "owner", column = @Column(name = "owner", length = 20)),
                              @AttributeOverride(name = "species", column = @Column(name = "species", length = 20)),
                              @AttributeOverride(name = "sex", column = @Column(name = "sex", length = 1)) })
              public PetId getId() {
                      return this.id;
              }
      
              public void setId(PetId id) {
                      this.id = id;
              }
      
      }
      
      package org.domain.SeamProject.entity;
      
      // Generated 5 May, 2008 1:25:14 PM by Hibernate Tools 3.2.1.GA
      
      import javax.persistence.Column;
      import javax.persistence.Embeddable;
      import org.hibernate.validator.Length;
      
      /**
       * PetId generated by hbm2java
       */
      @Embeddable
      public class PetId implements java.io.Serializable {
      
              private String name;
              private String owner;
              private String species;
              private Character sex;
      
              public PetId() {
              }
      
              public PetId(String name, String owner, String species, Character sex) {
                      this.name = name;
                      this.owner = owner;
                      this.species = species;
                      this.sex = sex;
              }
      
              @Column(name = "name", length = 20)
              @Length(max = 20)
              public String getName() {
                      return this.name;
              }
      
              public void setName(String name) {
                      this.name = name;
              }
      
              @Column(name = "owner", length = 20)
              @Length(max = 20)
              public String getOwner() {
                      return this.owner;
              }
      
              public void setOwner(String owner) {
                      
                      this.owner = owner;
              }
      
              @Column(name = "species", length = 20)
              @Length(max = 20)
              public String getSpecies() {
                      return this.species;
              }
      
              public void setSpecies(String species) {
                      this.species = species;
              }
      
              @Column(name = "sex", length = 1)
              public Character getSex() {
                      return this.sex;
              }
      
              public void setSex(Character sex) {
                      this.sex = sex;
              }
      
              public boolean equals(Object other) {
                              }
      
              public int hashCode() {
                      return result;
              }
      
      }
      
      |