java.lang.ClassCastException: ch.logobject.test.model.TaskProperties

Hibernate JIRA | Ortwin Glück | 1 decade ago
  1. 0

    Using Hibernate through JBoss EJB3: According to the EJB3 specs an entity only needs to be Serializable if it will be passed as a detached object out of a remote interface. As it seems Hibernate expects that entities be Serializable in some cases when joining. This should not be necessary to keep applications portable. Exceptions that can occur when fetching the one object of a ManyToOne relationship are: [exec] 2005-09-08 09:47:54,718 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - java.lang.ClassCastException: ch.logobject.test.model.Address [exec] 2005-09-08 09:47:54,718 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.loader.Loader.readCollectionElement(Loader.java:912) [exec] 2005-09-08 09:47:54,718 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.loader.Loader.readCollectionElements(Loader.java:619) [exec] 2005-09-08 09:47:54,718 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:563) [exec] 2005-09-08 09:47:54,718 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.loader.Loader.doQuery(Loader.java:666) [exec] 2005-09-08 09:47:54,718 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:221) [exec] 2005-09-08 09:47:54,718 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.loader.Loader.doList(Loader.java:2001) [exec] 2005-09-08 09:47:54,718 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.loader.Loader.list(Loader.java:1985) [exec] 2005-09-08 09:47:54,718 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:405) [exec] 2005-09-08 09:47:54,734 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:293) [exec] 2005-09-08 09:47:54,734 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.impl.SessionImpl.list(SessionImpl.java:864) [exec] 2005-09-08 09:47:54,734 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74) [exec] 2005-09-08 09:47:54,734 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:41) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - java.lang.ClassCastException: ch.logobject.test.model.TaskProperties [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.type.ManyToOneType.hydrate(ManyToOneType.java:95) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:1761) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1314) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1242) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.loader.Loader.getRow(Loader.java:1139) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:552) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.loader.Loader.doQuery(Loader.java:666) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:221) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.loader.Loader.doList(Loader.java:2001) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.loader.Loader.list(Loader.java:1985) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:405) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:293) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.impl.SessionImpl.list(SessionImpl.java:864) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:41)

    Hibernate JIRA | 1 decade ago | Ortwin Glück
    java.lang.ClassCastException: ch.logobject.test.model.TaskProperties
  2. 0

    Using Hibernate through JBoss EJB3: According to the EJB3 specs an entity only needs to be Serializable if it will be passed as a detached object out of a remote interface. As it seems Hibernate expects that entities be Serializable in some cases when joining. This should not be necessary to keep applications portable. Exceptions that can occur when fetching the one object of a ManyToOne relationship are: [exec] 2005-09-08 09:47:54,718 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - java.lang.ClassCastException: ch.logobject.test.model.Address [exec] 2005-09-08 09:47:54,718 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.loader.Loader.readCollectionElement(Loader.java:912) [exec] 2005-09-08 09:47:54,718 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.loader.Loader.readCollectionElements(Loader.java:619) [exec] 2005-09-08 09:47:54,718 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:563) [exec] 2005-09-08 09:47:54,718 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.loader.Loader.doQuery(Loader.java:666) [exec] 2005-09-08 09:47:54,718 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:221) [exec] 2005-09-08 09:47:54,718 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.loader.Loader.doList(Loader.java:2001) [exec] 2005-09-08 09:47:54,718 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.loader.Loader.list(Loader.java:1985) [exec] 2005-09-08 09:47:54,718 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:405) [exec] 2005-09-08 09:47:54,734 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:293) [exec] 2005-09-08 09:47:54,734 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.impl.SessionImpl.list(SessionImpl.java:864) [exec] 2005-09-08 09:47:54,734 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74) [exec] 2005-09-08 09:47:54,734 [SocketServerInvokerThread-10.11.1.211-1] INFO STDOUT - at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:41) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - java.lang.ClassCastException: ch.logobject.test.model.TaskProperties [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.type.ManyToOneType.hydrate(ManyToOneType.java:95) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:1761) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1314) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1242) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.loader.Loader.getRow(Loader.java:1139) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:552) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.loader.Loader.doQuery(Loader.java:666) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:221) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.loader.Loader.doList(Loader.java:2001) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.loader.Loader.list(Loader.java:1985) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:405) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:293) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.impl.SessionImpl.list(SessionImpl.java:864) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74) [exec] 2005-09-08 09:56:39,218 [SocketServerInvokerThread-10.11.1.211-2] INFO STDOUT - at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:41)

    Hibernate JIRA | 1 decade ago | Ortwin Glück
    java.lang.ClassCastException: ch.logobject.test.model.TaskProperties
  3. 0

    JPA/Hibernate query with class name?

    Stack Overflow | 7 years ago | Petteri Hietavirta
    java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    HQL Casting Error

    Stack Overflow | 6 years ago | Noor
    java.lang.ClassCastException: java.util.LinkedList cannot be cast to java.lang.Long
  6. 0

    Hibernate Envers: Problem querying revisions

    Stack Overflow | 6 years ago | martin
    java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Map

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      ch.logobject.test.model.TaskProperties

      at org.hibernate.type.ManyToOneType.hydrate()
    2. Hibernate
      QueryLoader.list
      1. org.hibernate.type.ManyToOneType.hydrate(ManyToOneType.java:95)
      2. org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:1761)
      3. org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1314)
      4. org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1242)
      5. org.hibernate.loader.Loader.getRow(Loader.java:1139)
      6. org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:552)
      7. org.hibernate.loader.Loader.doQuery(Loader.java:666)
      8. org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:221)
      9. org.hibernate.loader.Loader.doList(Loader.java:2001)
      10. org.hibernate.loader.Loader.list(Loader.java:1985)
      11. org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:405)
      11 frames
    3. Hibernate HQL/JP-QL Parser
      QueryTranslatorImpl.list
      1. org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:293)
      1 frame
    4. Hibernate
      QueryImpl.list
      1. org.hibernate.impl.SessionImpl.list(SessionImpl.java:864)
      2. org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
      2 frames
    5. Hibernate EJB
      QueryImpl.getResultList
      1. org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:41)
      1 frame