java.lang.ClassCastException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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)
    via by Ortwin Glück,
  • 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)
    via by Ortwin Glück,
  • HQL Casting Error
    via Stack Overflow by Noor
    ,
  • Hibernate Envers: Problem querying revisions
    via Stack Overflow by martin
    ,
  • Spring hibernate template list as a parameter
    via Stack Overflow by Hurda
    ,
    • java.lang.ClassCastException: ch.logobject.test.model.TaskProperties at org.hibernate.type.ManyToOneType.hydrate(ManyToOneType.java:95) at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:1761) at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1314) at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1242) at org.hibernate.loader.Loader.getRow(Loader.java:1139) at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:552) at org.hibernate.loader.Loader.doQuery(Loader.java:666) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:221) at org.hibernate.loader.Loader.doList(Loader.java:2001) at org.hibernate.loader.Loader.list(Loader.java:1985) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:405) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:293) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:864) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74) at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:41)
    No Bugmate found.