0 Replies Latest reply on Apr 18, 2009 8:04 AM by madhu reddy

    java.lang.IllegalArgumentException argument type mismatch

    madhu reddy Newbie
      hi every one,
               I had been strucked with this problem can anyone i feel great

      for my table there is an composite primary key relation and by using seam-gen it generates two entities.i.e. AppRoleFunction.java and AppRoleFunctionId.java

      AppRoleFunction.java



      package com.infyz.toms.entity;

      // Generated 9 Apr, 2009 2:39:47 PM by Hibernate Tools 3.2.2.GA

      import java.util.Date;
      import javax.persistence.AttributeOverride;
      import javax.persistence.AttributeOverrides;
      import javax.persistence.Column;
      import javax.persistence.EmbeddedId;
      import javax.persistence.Entity;
      import javax.persistence.FetchType;
      import javax.persistence.JoinColumn;
      import javax.persistence.JoinColumns;
      import javax.persistence.ManyToOne;
      import javax.persistence.Table;
      import javax.persistence.Temporal;
      import javax.persistence.TemporalType;
      import javax.persistence.UniqueConstraint;
      import org.hibernate.validator.Length;
      import org.hibernate.validator.NotNull;

      /**
      * AppRoleFunction generated by hbm2java
      */
      @Entity
      @Table(name = "app_role_function", catalog = "toms_tables", uniqueConstraints = @UniqueConstraint(columnNames = {
                      "ROLE_CODE", "FUNCTION_CODE" }))
      public class AppRoleFunction implements java.io.Serializable {

              private AppRoleFunctionId id;
              private AppFunction appFunction;
              private AppRole appRole;
              private String FInactive;
              private int createdBy;
              private Date createdDate;
              private int modifiedBy;
              private Date modifiedDate;

              public AppRoleFunction() {
              }

              public AppRoleFunction(AppRoleFunctionId id, AppFunction appFunction,
                              AppRole appRole, String FInactive, int createdBy, Date createdDate,
                              int modifiedBy, Date modifiedDate) {
                      this.id = id;
                      this.appFunction = appFunction;
                      this.appRole = appRole;
                      this.FInactive = FInactive;
                      this.createdBy = createdBy;
                      this.createdDate = createdDate;
                      this.modifiedBy = modifiedBy;
                      this.modifiedDate = modifiedDate;
              }

              @EmbeddedId
              @AttributeOverrides( {
                              @AttributeOverride(name = "appId", column = @Column(name = "APP_ID", nullable = false)),
                              @AttributeOverride(name = "roleCode", column = @Column(name = "ROLE_CODE", nullable = false, length = 5)),
                              @AttributeOverride(name = "functionCode", column = @Column(name = "FUNCTION_CODE", nullable = false, length = 5)) })
              @NotNull
              public AppRoleFunctionId getId() {
                      return this.id;
              }

              public void setId(AppRoleFunctionId id) {
                      this.id = id;
              }

              @ManyToOne(fetch = FetchType.LAZY)
              @JoinColumns( {
                              @JoinColumn(name = "APP_ID", referencedColumnName = "APP_ID", nullable = false, insertable = false, updatable = false),
                              @JoinColumn(name = "FUNCTION_CODE", referencedColumnName = "FUNCTION_CODE", nullable = false, insertable = false, updatable = false) })
              @NotNull
              public AppFunction getAppFunction() {
                      return this.appFunction;
              }

              public void setAppFunction(AppFunction appFunction) {
                      this.appFunction = appFunction;
              }

              @ManyToOne(fetch = FetchType.LAZY)
              @JoinColumns( {
                              @JoinColumn(name = "APP_ID", referencedColumnName = "APP_ID", nullable = false, insertable = false, updatable = false),
                              @JoinColumn(name = "ROLE_CODE", referencedColumnName = "ROLE_CODE", nullable = false, insertable = false, updatable = false) })
              @NotNull
              public AppRole getAppRole() {
                      return this.appRole;
              }

              public void setAppRole(AppRole appRole) {
                      this.appRole = appRole;
              }

              @Column(name = "F_INACTIVE", nullable = false, length = 1)
              @NotNull
              @Length(max = 1)
              public String getFInactive() {
                      return this.FInactive;
              }

              public void setFInactive(String FInactive) {
                      this.FInactive = FInactive;
              }

              @Column(name = "CREATED_BY", nullable = false)
              @NotNull
              public int getCreatedBy() {
                      return this.createdBy;
              }

              public void setCreatedBy(int createdBy) {
                      this.createdBy = createdBy;
              }

              @Temporal(TemporalType.TIMESTAMP)
              @Column(name = "CREATED_DATE", nullable = false, length = 0)
              @NotNull
              public Date getCreatedDate() {
                      return this.createdDate;
              }

              public void setCreatedDate(Date createdDate) {
                      this.createdDate = createdDate;
              }

              @Column(name = "MODIFIED_BY", nullable = false)
              @NotNull
              public int getModifiedBy() {
                      return this.modifiedBy;
              }

              public void setModifiedBy(int modifiedBy) {
                      this.modifiedBy = modifiedBy;
              }

              @Temporal(TemporalType.TIMESTAMP)
              @Column(name = "MODIFIED_DATE", nullable = false, length = 0)
              @NotNull
              public Date getModifiedDate() {
                      return this.modifiedDate;
              }

              public void setModifiedDate(Date modifiedDate) {
                      this.modifiedDate = modifiedDate;
              }
              public boolean equals(Object other) {
                      if ((this == other))
                              return true;
                      if ((other == null))
                              return false;
                      if (!(other instanceof AppRoleFunctionId))
                              return false;
                      AppRoleFunctionId castOther = (AppRoleFunctionId) other;

                      return (this.getId().getAppId() == castOther.getAppId())
                                      && ((this.getId().getRoleCode() == castOther.getRoleCode()) || (this
                                                      .getId().getRoleCode() != null
                                                      && castOther.getRoleCode() != null && this
                                                      .getId().getRoleCode().equals(castOther.getRoleCode())))
                                      && ((this.getId().getFunctionCode() == castOther.getFunctionCode()) || (this
                                                      .getId().getFunctionCode() != null
                                                      && castOther.getFunctionCode() != null && this
                                                      .getId().getFunctionCode().equals(castOther.getFunctionCode())));
              }

              public int hashCode() {
                      int result = 17;

                      result = 37 * result + (this.getId().getAppId());
                      result = 37 * result
                                      + (this.getId().getRoleCode() == null ? 0 : this.getId().getRoleCode().hashCode());
                      result = 37
                                      * result
                                      + (this.getId().getFunctionCode() == null ? 0 : this.getId().getFunctionCode()
                                                      .hashCode());
                      return result;
              }
             

      }





      AppRoleFunctionId.java:




      package com.infyz.toms.entity;

      // Generated 9 Apr, 2009 2:39:47 PM by Hibernate Tools 3.2.2.GA

      import javax.persistence.Column;
      import javax.persistence.Embeddable;
      import org.hibernate.validator.Length;
      import org.hibernate.validator.NotNull;

      /**
      * AppRoleFunctionId generated by hbm2java
      */
      @Embeddable
      public class AppRoleFunctionId implements java.io.Serializable {

              private int appId;
              private String roleCode;
              private String functionCode;

              public AppRoleFunctionId() {
              }

              public AppRoleFunctionId(int appId, String roleCode, String functionCode) {
                      this.appId = appId;
                      this.roleCode = roleCode;
                      this.functionCode = functionCode;
              }

              @Column(name = "APP_ID", nullable = false)
              @NotNull
              public int getAppId() {
                      return this.appId;
              }

              public void setAppId(int appId) {
                      this.appId = appId;
              }

              @Column(name = "ROLE_CODE", nullable = false, length = 5)
              @NotNull
              @Length(max = 5)
              public String getRoleCode() {
                      return this.roleCode;
              }

              public void setRoleCode(String roleCode) {
                      this.roleCode = roleCode;
              }

              @Column(name = "FUNCTION_CODE", nullable = false, length = 5)
              @NotNull
              @Length(max = 5)
              public String getFunctionCode() {
                      return this.functionCode;
              }

              public void setFunctionCode(String functionCode) {
                      this.functionCode = functionCode;
              }

              public boolean equals(Object other) {
                      if ((this == other))
                              return true;
                      if ((other == null))
                              return false;
                      if (!(other instanceof AppRoleFunctionId))
                              return false;
                      AppRoleFunctionId castOther = (AppRoleFunctionId) other;

                      return (this.getAppId() == castOther.getAppId())
                                      && ((this.getRoleCode() == castOther.getRoleCode()) || (this
                                                      .getRoleCode() != null
                                                      && castOther.getRoleCode() != null && this
                                                      .getRoleCode().equals(castOther.getRoleCode())))
                                      && ((this.getFunctionCode() == castOther.getFunctionCode()) || (this
                                                      .getFunctionCode() != null
                                                      && castOther.getFunctionCode() != null && this
                                                      .getFunctionCode().equals(castOther.getFunctionCode())));
              }

              public int hashCode() {
                      int result = 17;

                      result = 37 * result + this.getAppId();
                      result = 37 * result
                                      + (getRoleCode() == null ? 0 : this.getRoleCode().hashCode());
                      result = 37
                                      * result
                                      + (getFunctionCode() == null ? 0 : this.getFunctionCode()
                                                      .hashCode());
                      return result;
              }

      }





      in my xhtml i put a drop down for entering the id value.but it giving the following error

      hg/AppRoleFunctionList.xhtml @121,99 value="#{approlefunction.id.appId}": java.lang.IllegalArgumentException: argument type mismatch



      my dropdown code is as shown below:


      <s:decorate id="appIdField" template="../layout/edit.xhtml">
                      <ui:define name="label">App Id</ui:define>
                      <h:selectOneMenu value="#{approlefunction.id.appId}" required="true" id="appinfo">
                                              <s:selectItems value="#{appInfos}" var="appinfo" label="#{appinfo.appId}"  noSelectionLabel="Please Select..."/>
                                <s:convertEntity />
                                 </h:selectOneMenu>
                                 </s:decorate> 




      when i put input text it will taking the value and there is no error and when i put a dropdown then the above error occurs.can any one help me.


      thanks and Regards
      madhu