1 Reply Latest reply on Aug 3, 2006 1:46 AM by Piotr Czekaj

    Problem with editing entity if it uses @EmbeddedId

    Piotr Czekaj Newbie

      I'm having problems with editing entity with @EmbeddedId. On page I've placed inputText element for every PK field, for example:
      <h:inputText id="id_nr" value="#{uscModpskr.id.nr}" required="true"/>
      I can see in inputText proper values fetched from database but when I click h:commandButton I'm getting 5 times Conversion error occurred message. My PK contains 5 fields: 2 strings, 2 ints, one char field.

      @Stateful
      @Name("marriageSearch")
      @Scope(ScopeType.SESSION)
      public class MarriageSearchingAction implements MarriageSearching, Serializable {
      
       @In(required=false)
       @Out(required=false)
       private UscModpskr uscModpskr;
      
       //[...]
      }
      
      // Generated 2006-06-04 20:38:58 by Hibernate Tools 3.1.0.beta5
      @Entity
      @Table(name = "usc_modpskr", uniqueConstraints = {})
      @Name("uscModpskr")
      public class UscModpskr implements java.io.Serializable {
      
       // Fields
       private UscId id;
      
       private String dzpl;
       //[...many other fields...]
      
       @EmbeddedId
       @AttributeOverrides( {
       @AttributeOverride(name = "idusc", column = @Column(name = "idusc", unique = false, nullable = false, insertable = true, updatable = true, length = 10)),
       @AttributeOverride(name = "rk", column = @Column(name = "rk", unique = false, nullable = false, insertable = true, updatable = true)),
       @AttributeOverride(name = "dz", column = @Column(name = "dz", unique = false, nullable = false, insertable = true, updatable = true, length = 20)),
       @AttributeOverride(name = "nr", column = @Column(name = "nr", unique = false, nullable = false, insertable = true, updatable = true)),
       @AttributeOverride(name = "nrp", column = @Column(name = "nrp", unique = false, nullable = false, insertable = true, updatable = true, length = 1)) })
       public UscId getId() {
       return this.id;
       }
      
       public void setId(UscId id) {
       this.id = id;
       }
      }
      
      @Embeddable
      public class UscId implements java.io.Serializable {
      
       private String idusc;
      
       private int rk;
      
       private String dz;
      
       private int nr;
      
       private char nrp;
      
       //[...getters and setters...]
      }