2 Replies Latest reply on Feb 8, 2006 5:54 PM by nholbrook

    Hibernate assigning wrong value to property?

    nholbrook

      I made the primary key of SecCompany a composite key and now I am unable to do anything with the SecUser class which has a reference to it as a foreign key. I can't insert, find, etc. I have included both classes, hibernate debug, stack trace, etc. It seems to be trying to set the type_id to the company_id when I load a user and I don't know why. The company loads fine by itself. Any help would be greatly appreciated.

      Thanks

      Nic


      CREATE TABLE sec_company (
      company_id BIGINT UNSIGNED NOT NULL,
      type_id CHAR(1) NOT NULL,
      ref_id INTEGER UNSIGNED NULL,
      name VARCHAR(45) NULL,
      update_date DATE NULL,
      update_by VARCHAR(45) NULL,
      PRIMARY KEY(company_id, type_id)
      )
      TYPE=InnoDB;

      CREATE TABLE sec_user (
      user_id VARCHAR(45) NOT NULL,
      company_id BIGINT UNSIGNED NOT NULL,
      type_id CHAR(1) NOT NULL,
      status_id CHAR(1) NOT NULL,
      user_fname VARCHAR(45) NULL,
      user_lname VARCHAR(45) NULL,
      user_passwd VARCHAR(45) NULL,
      passwd_expire_date DATE NULL,
      passwd_fail_count INTEGER UNSIGNED NULL,
      security_question VARCHAR(255) NULL,
      security_response VARCHAR(255) NULL,
      create_date DATE NULL,
      update_date DATE NULL,
      update_by VARCHAR(45) NULL,
      locale VARCHAR(20) NULL DEFAULT 'en_US',
      PRIMARY KEY(user_id),
      FOREIGN KEY(status_id)
      REFERENCES sec_user_status(status_id),
      FOREIGN KEY(company_id, type_id)
      REFERENCES sec_company(company_id, type_id)
      )
      TYPE=InnoDB;

      @Entity

      @Table(name = "sec_user", catalog = "teslsm", uniqueConstraints = {})

      @NamedQueries(value = {@NamedQuery(name = "SecUser.findByGroupId", query = "select user from SecUser as user, SecUserGroupXref xref where "

      + "user.userId = xref.id.userId and xref.id.groupId = :groupId")})

      public class SecUser

      implements java.io.Serializable

      {

      /**

      * [Param type = String : name = groupId]

      */

      public static final String QUERY_FIND_BY_GROUPID = "SecUser.findByGroupId";



      // Fields



      private String userId;

      private SecUserStatus secUserStatus;

      private SecCompany secCompany;

      private String userFname;

      private String userLname;

      private String userPasswd;

      private String userPasswd2;

      private Date passwdExpireDate;

      private Integer passwdFailCount;

      private String securityQuestion;

      private String securityResponse;

      private Date createDate;

      private Date updateDate;

      private String updateBy;

      private String locale;

      private Set secUserGroupXrefs = new HashSet(0);

      private Set secUserRoleXrefs = new HashSet(0);



      // Constructors



      /** default constructor */

      public SecUser()

      {

      }



      /** minimal constructor */

      public SecUser(String userId, SecUserStatus secUserStatus, SecCompany secCompany)

      {

      this.userId = userId;

      this.secUserStatus = secUserStatus;

      this.secCompany = secCompany;

      }



      /** full constructor */

      public SecUser(String userId, SecUserStatus secUserStatus, SecCompany secCompany, String userFname,

      String userLname, String userPasswd, Date passwdExpireDate, Integer passwdFailCount,

      String securityQuestion, String securityResponse, Date createDate, Date updateDate,

      String updateBy, String locale, Set secUserGroupXrefs,

      Set secUserRoleXrefs)

      {

      this.userId = userId;

      this.secUserStatus = secUserStatus;

      this.secCompany = secCompany;

      this.userFname = userFname;

      this.userLname = userLname;

      this.userPasswd = userPasswd;

      this.passwdExpireDate = passwdExpireDate;

      this.passwdFailCount = passwdFailCount;

      this.securityQuestion = securityQuestion;

      this.securityResponse = securityResponse;

      this.createDate = createDate;

      this.updateDate = updateDate;

      this.updateBy = updateBy;

      this.locale = locale;

      this.secUserGroupXrefs = secUserGroupXrefs;

      this.secUserRoleXrefs = secUserRoleXrefs;

      }



      // Property accessors

      @Id

      @Column(name = "user_id", unique = true, nullable = false, insertable = true, updatable = true, length = 45)

      public String getUserId()

      {

      return this.userId;

      }



      public void setUserId(String userId)

      {

      this.userId = userId;

      }



      @ManyToOne(cascade = {}, fetch = FetchType.LAZY)

      @JoinColumn(name = "status_id", unique = false, nullable = false, insertable = true, updatable = true)

      public SecUserStatus getSecUserStatus()

      {

      return this.secUserStatus;

      }



      public void setSecUserStatus(SecUserStatus secUserStatus)

      {

      this.secUserStatus = secUserStatus;

      }



      @ManyToOne(cascade = {}, fetch = FetchType.LAZY)

      @JoinColumns( {

      @JoinColumn(name = "company_id", unique = false, nullable = false, insertable = true, updatable = true),

      @JoinColumn(name = "type_id", unique = false, nullable = false, insertable = true, updatable = true)})

      public SecCompany getSecCompany()

      {

      return this.secCompany;

      }



      public void setSecCompany(SecCompany secCompany)

      {

      this.secCompany = secCompany;

      }



      @Column(name = "user_fname", unique = false, nullable = true, insertable = true, updatable = true, length = 45)

      public String getUserFname()

      {

      return this.userFname;

      }



      public void setUserFname(String userFname)

      {

      this.userFname = userFname;

      }



      @Column(name = "user_lname", unique = false, nullable = true, insertable = true, updatable = true, length = 45)

      public String getUserLname()

      {

      return this.userLname;

      }



      public void setUserLname(String userLname)

      {

      this.userLname = userLname;

      }



      @Column(name = "user_passwd", unique = false, nullable = true, insertable = true, updatable = true, length = 45)

      public String getUserPasswd()

      {

      return this.userPasswd;

      }



      public void setUserPasswd(String userPasswd)

      {

      this.userPasswd = userPasswd;

      }



      @Transient

      public String getUserPasswd2()

      {

      return userPasswd2;

      }



      public void setUserPasswd2(String userPasswd2)

      {

      this.userPasswd2 = userPasswd2;

      }



      @Column(name = "passwd_expire_date", unique = false, nullable = true, insertable = true, updatable = true, length = 10)

      public Date getPasswdExpireDate()

      {

      return this.passwdExpireDate;

      }



      public void setPasswdExpireDate(Date passwdExpireDate)

      {

      this.passwdExpireDate = passwdExpireDate;

      }



      @Column(name = "passwd_fail_count", unique = false, nullable = true, insertable = true, updatable = true)

      public Integer getPasswdFailCount()

      {

      return this.passwdFailCount;

      }



      public void setPasswdFailCount(Integer passwdFailCount)

      {

      this.passwdFailCount = passwdFailCount;

      }



      @Column(name = "security_question", unique = false, nullable = true, insertable = true, updatable = true)

      public String getSecurityQuestion()

      {

      return this.securityQuestion;

      }



      public void setSecurityQuestion(String securityQuestion)

      {

      this.securityQuestion = securityQuestion;

      }



      @Column(name = "security_response", unique = false, nullable = true, insertable = true, updatable = true)

      public String getSecurityResponse()

      {

      return this.securityResponse;

      }



      public void setSecurityResponse(String securityResponse)

      {

      this.securityResponse = securityResponse;

      }



      @Column(name = "create_date", unique = false, nullable = true, insertable = true, updatable = true, length = 10)

      public Date getCreateDate()

      {

      return this.createDate;

      }



      public void setCreateDate(Date createDate)

      {

      this.createDate = createDate;

      }



      @Column(name = "update_date", unique = false, nullable = true, insertable = true, updatable = true, length = 10)

      public Date getUpdateDate()

      {

      return this.updateDate;

      }



      public void setUpdateDate(Date updateDate)

      {

      this.updateDate = updateDate;

      }



      @Column(name = "update_by", unique = false, nullable = true, insertable = true, updatable = true, length = 45)

      public String getUpdateBy()

      {

      return this.updateBy;

      }



      public void setUpdateBy(String updateBy)

      {

      this.updateBy = updateBy;

      }



      @Column(name = "locale", unique = false, nullable = true, insertable = true, updatable = true, length = 20)

      public String getLocale()

      {

      return this.locale;

      }



      public void setLocale(String locale)

      {

      this.locale = locale;

      }



      @OneToMany(cascade = {CascadeType.ALL}, fetch = FetchType.LAZY, mappedBy = "secUser")

      public Set getSecUserGroupXrefs()

      {

      return this.secUserGroupXrefs;

      }



      public void setSecUserGroupXrefs(Set secUserGroupXrefs)

      {

      this.secUserGroupXrefs = secUserGroupXrefs;

      }



      @OneToMany(cascade = {CascadeType.ALL}, fetch = FetchType.LAZY, mappedBy = "secUser")

      public Set getSecUserRoleXrefs()

      {

      return this.secUserRoleXrefs;

      }



      public void setSecUserRoleXrefs(Set secUserRoleXrefs)

      {

      this.secUserRoleXrefs = secUserRoleXrefs;

      }



      }




      @Entity

      @Table(name = "sec_company", catalog = "teslsm", uniqueConstraints = {})

      public class SecCompany

      implements java.io.Serializable

      {



      // Fields



      private SecCompanyId id;

      private Integer refId;

      private String name;

      private Date updateDate;

      private String updateBy;

      private Set secGroups = new HashSet(0);

      private Set secUsers = new HashSet(0);



      // Constructors



      /** default constructor */

      public SecCompany()

      {

      }



      /** minimal constructor */

      public SecCompany(SecCompanyId id)

      {

      this.id = id;

      }



      /** full constructor */

      public SecCompany(SecCompanyId id, Integer refId, String name, Date updateDate, String updateBy,

      Set secGroups, Set secUsers)

      {

      this.id = id;

      this.refId = refId;

      this.name = name;

      this.updateDate = updateDate;

      this.updateBy = updateBy;

      this.secGroups = secGroups;

      this.secUsers = secUsers;

      }



      // Property accessors

      @EmbeddedId

      @AttributeOverrides( {

      @AttributeOverride(name = "companyId", column = @Column(name = "company_id", unique = false, nullable = false, insertable = true, updatable = true)),

      @AttributeOverride(name = "typeId", column = @Column(name = "type_id", unique = false, nullable = false, insertable = true, updatable = true, length = 1))})

      public SecCompanyId getId()

      {

      return this.id;

      }



      public void setId(SecCompanyId id)

      {

      this.id = id;

      }



      @Column(name = "ref_id", unique = false, nullable = true, insertable = true, updatable = true)

      public Integer getRefId()

      {

      return this.refId;

      }



      public void setRefId(Integer refId)

      {

      this.refId = refId;

      }



      @Column(name = "name", unique = false, nullable = true, insertable = true, updatable = true, length = 45)

      public String getName()

      {

      return this.name;

      }



      public void setName(String name)

      {

      this.name = name;

      }



      @Column(name = "update_date", unique = false, nullable = true, insertable = true, updatable = true, length = 10)

      public Date getUpdateDate()

      {

      return this.updateDate;

      }



      public void setUpdateDate(Date updateDate)

      {

      this.updateDate = updateDate;

      }



      @Column(name = "update_by", unique = false, nullable = true, insertable = true, updatable = true, length = 45)

      public String getUpdateBy()

      {

      return this.updateBy;

      }



      public void setUpdateBy(String updateBy)

      {

      this.updateBy = updateBy;

      }



      @OneToMany(cascade = {CascadeType.ALL}, fetch = FetchType.LAZY, mappedBy = "secCompany")

      public Set getSecGroups()

      {

      return this.secGroups;

      }



      public void setSecGroups(Set secGroups)

      {

      this.secGroups = secGroups;

      }



      @OneToMany(cascade = {CascadeType.ALL}, fetch = FetchType.LAZY, mappedBy = "secCompany")

      public Set getSecUsers()

      {

      return this.secUsers;

      }



      public void setSecUsers(Set secUsers)

      {

      this.secUsers = secUsers;

      }



      }



      Need help with Hibernate? Read this first:
      http://www.hibernate.org/ForumMailinglists/HowToAskForHelp

      Hibernate version: 3.1.2

      Code between sessionFactory.openSession() and session.close():

      entityManager.persist(user);

      Full stack trace of any exception that occurs:

      2006-02-08 11:33:37,979 DEBUG [org.hibernate.util.JDBCExceptionReporter] could not load an entity: [com.tess.security.model.SecUser#sysop] []

      java.sql.SQLException: Invalid value for getLong() - 'F' in column 8
      at com.mysql.jdbc.ResultSet.getLongFromString(ResultSet.java:2601)
      at com.mysql.jdbc.ResultSet.getNativeLong(ResultSet.java:3870)
      at com.mysql.jdbc.ResultSet.getLong(ResultSet.java:2557)
      at com.mysql.jdbc.ResultSet.getLong(ResultSet.java:2572)
      at org.jboss.resource.adapter.jdbc.WrappedResultSet.getLong(WrappedResultSet.java:716)
      at org.hibernate.type.LongType.get(LongType.java:28)
      at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:113)
      at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:102)
      at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
      at org.hibernate.type.ComponentType.hydrate(ComponentType.java:506)
      at org.hibernate.type.ComponentType.nullSafeGet(ComponentType.java:229)
      at org.hibernate.type.ManyToOneType.hydrate(ManyToOneType.java:95)
      at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:1899)
      at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1372)
      at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1300)
      at org.hibernate.loader.Loader.getRow(Loader.java:1197)
      at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:569)
      at org.hibernate.loader.Loader.doQuery(Loader.java:689)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
      at org.hibernate.loader.Loader.loadEntity(Loader.java:1785)
      at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:93)
      at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:81)
      at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2730)
      at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:365)
      at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:346)
      at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:123)
      at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:177)
      at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
      at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:891)
      at org.hibernate.impl.SessionImpl.get(SessionImpl.java:828)
      at org.hibernate.impl.SessionImpl.get(SessionImpl.java:821)
      at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:102)
      at org.jboss.ejb3.entity.InjectedEntityManager.find(InjectedEntityManager.java:136)
      at com.tess.common.service.AbstractPersistenceManagerImpl.findById(AbstractPersistenceManagerImpl.java:100)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:109)
      at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
      at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:196)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:54)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:178)
      at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:74)
      at $Proxy94.findById(Unknown Source)
      at com.tess.security.proxy.SecurityServicesProxyBean.findById(SecurityServicesProxyBean.java:71)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:109)
      at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
      at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:192)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:54)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:219)
      at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:107)
      at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
      at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:660)
      at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:513)
      at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:290)
      at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:344)
      at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:202)
      2006-02-08 11:33:37,981 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: S1009
      2006-02-08 11:33:37,981 ERROR [org.hibernate.util.JDBCExceptionReporter] Invalid value for getLong() - 'F' in column 8
      2006-02-08 11:33:37,981 INFO [org.hibernate.event.def.DefaultLoadEventListener] Error performing load command
      org.hibernate.exception.GenericJDBCException: could not load an entity: [com.tess.security.model.SecUser#sysop]
      at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
      at org.hibernate.loader.Loader.loadEntity(Loader.java:1799)
      at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:93)
      at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:81)
      at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2730)
      at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:365)
      at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:346)
      at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:123)
      at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:177)
      at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
      at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:891)
      at org.hibernate.impl.SessionImpl.get(SessionImpl.java:828)
      at org.hibernate.impl.SessionImpl.get(SessionImpl.java:821)
      at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:102)
      at org.jboss.ejb3.entity.InjectedEntityManager.find(InjectedEntityManager.java:136)
      at com.tess.common.service.AbstractPersistenceManagerImpl.findById(AbstractPersistenceManagerImpl.java:100)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:109)
      at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
      at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:196)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:54)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:178)
      at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:74)
      at $Proxy94.findById(Unknown Source)
      at com.tess.security.proxy.SecurityServicesProxyBean.findById(SecurityServicesProxyBean.java:71)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:109)
      at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
      at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:192)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:54)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:219)
      at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:107)
      at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
      at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:660)
      at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:513)
      at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:290)
      at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:344)
      at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:202)
      Caused by: java.sql.SQLException: Invalid value for getLong() - 'F' in column 8
      at com.mysql.jdbc.ResultSet.getLongFromString(ResultSet.java:2601)
      at com.mysql.jdbc.ResultSet.getNativeLong(ResultSet.java:3870)
      at com.mysql.jdbc.ResultSet.getLong(ResultSet.java:2557)
      at com.mysql.jdbc.ResultSet.getLong(ResultSet.java:2572)
      at org.jboss.resource.adapter.jdbc.WrappedResultSet.getLong(WrappedResultSet.java:716)
      at org.hibernate.type.LongType.get(LongType.java:28)
      at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:113)
      at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:102)
      at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
      at org.hibernate.type.ComponentType.hydrate(ComponentType.java:506)
      at org.hibernate.type.ComponentType.nullSafeGet(ComponentType.java:229)
      at org.hibernate.type.ManyToOneType.hydrate(ManyToOneType.java:95)
      at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:1899)
      at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1372)
      at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1300)
      at org.hibernate.loader.Loader.getRow(Loader.java:1197)
      at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:569)
      at org.hibernate.loader.Loader.doQuery(Loader.java:689)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
      at org.hibernate.loader.Loader.loadEntity(Loader.java:1785)
      ... 66 more

      Name and version of the database you are using:

      Mysql 5.x

      The generated SQL (show_sql=true):

      select secuser0_.user_id as user1_1_0_, secuser0_.locale as locale1_0_, secuser0_.user_passwd as user3_1_0_, secuser0_.status_id as status13_1_0_, secuser0_.passwd_expire_date as passwd4_1_0_, secuser0_.passwd_fail_count as passwd5_1_0_, secuser0_.company_id as company14_1_0_, secuser0_.type_id as type15_1_0_, secuser0_.update_date as update6_1_0_, secuser0_.update_by as update7_1_0_, secuser0_.user_fname as user8_1_0_, secuser0_.user_lname as user9_1_0_, secuser0_.security_question as security10_1_0_, secuser0_.security_response as security11_1_0_, secuser0_.create_date as create12_1_0_ from teslsm.sec_user secuser0_ where secuser0_.user_id=?

        • 1. Re: Hibernate assigning wrong value to property?
          nholbrook

          Sorry, forgot to post the CompanyId class. By the way, this was all generated with the jbosside 1.5 hibernate tools.

          /**

          * SecCompanyId generated by hbm2java

          */

          @Embeddable

          public class SecCompanyId

          implements java.io.Serializable

          {



          // Fields



          private Integer companyId;

          private Character typeId;



          // Constructors



          /** default constructor */

          public SecCompanyId()

          {

          }



          /** full constructor */

          public SecCompanyId(Integer companyId, Character typeId)

          {

          this.companyId = companyId;

          this.typeId = typeId;

          }



          // Property accessors

          @Column(name = "company_id", unique = false, nullable = false, insertable = true, updatable = true)

          public Integer getCompanyId()

          {

          return this.companyId;

          }



          public void setCompanyId(Integer companyId)

          {

          this.companyId = companyId;

          }



          @Column(name = "type_id", unique = false, nullable = false, insertable = true, updatable = true, length = 1)

          public Character getTypeId()

          {

          return this.typeId;

          }



          public void setTypeId(Character typeId)

          {

          this.typeId = typeId;

          }



          public boolean equals(Object other)

          {

          if ((this == other))

          return true;

          if ((other == null))

          return false;

          if (!(other instanceof SecCompanyId))

          return false;

          SecCompanyId castOther = (SecCompanyId) other;



          return ((this.getCompanyId() == castOther.getCompanyId()) || (this.getCompanyId() != null

          && castOther.getCompanyId() != null && this.getCompanyId().equals(castOther.getCompanyId())))

          && ((this.getTypeId() == castOther.getTypeId()) || (this.getTypeId() != null

          && castOther.getTypeId() != null && this.getTypeId().equals(castOther.getTypeId())));

          }



          public int hashCode()

          {

          int result = 17;



          result = 37 * result + (getCompanyId() == null ? 0 : this.getCompanyId().hashCode());

          result = 37 * result + (getTypeId() == null ? 0 : this.getTypeId().hashCode());

          return result;

          }



          }

          • 2. Re: Hibernate assigning wrong value to property?
            nholbrook

            I just went back to a single primary key id for company and everything works great again. I have no idea why this is working this way, but if I figure it out, I'll try to post here.