[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2052) org.hibernate.pretty.MessageHelper.collectionInfoString tries to cast wrong object to String, causes ClassCastException
senthil (JIRA)
noreply at atlassian.com
Mon Nov 15 16:59:14 EST 2010
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2052?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=39125#action_39125 ]
senthil commented on HHH-2052:
------------------------------
We also have the same issue which throws ClassCastException to String object
> org.hibernate.pretty.MessageHelper.collectionInfoString tries to cast wrong object to String, causes ClassCastException
> -----------------------------------------------------------------------------------------------------------------------
>
> Key: HHH-2052
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2052
> Project: Hibernate Core
> Issue Type: Bug
> Reporter: Tree 'Huggy Bear' Hugger
> Attachments: bugtest.zip
>
>
> Debug level logging attempted by MessageHelper falls over when constructing a loggable string for a mapped collection on the main entity.
> Following the code in the stacktrace, I can see that MessageHelper expects the parent key for the collection relationship to be the primary key, but it is mapped to another field of a different type via a property-ref. Hence the ClassCastException below.
> The work around is to set logging to INFO or higher.
> I have also attached a pared-down zip with the maven 2 project containing the mappings and the unit test which fails.
> The following JIRA issue may be the same thing:
> http://opensource.atlassian.com/projects/hibernate/browse/ANN-298
> The following messages on the Hib forum demonstrate other interest in this issue:
> http://forum.hibernate.org/viewtopic.php?t=949913
> http://forum.hibernate.org/viewtopic.php?t=956778
> http://forum.hibernate.org/viewtopic.php?t=962471
> java.lang.ClassCastException: com.nomadsoft.cortex.domain.country.basic.BasicCountry
> at org.hibernate.type.StringType.toString(StringType.java:44)
> at org.hibernate.type.NullableType.toLoggableString(NullableType.java:168)
> at org.hibernate.pretty.MessageHelper.collectionInfoString(MessageHelper.java:284)
> at org.hibernate.loader.Loader.readCollectionElement(Loader.java:972)
> at org.hibernate.loader.Loader.readCollectionElements(Loader.java:635)
> at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
> 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:47)
> at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:41)
> 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:862)
> at org.hibernate.impl.SessionImpl.get(SessionImpl.java:799)
> at org.hibernate.impl.SessionImpl.get(SessionImpl.java:792)
> at org.springframework.orm.hibernate3.HibernateTemplate$1.doInHibernate(HibernateTemplate.java:452)
> at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:366)
> at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:446)
> at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:440)
> at com.nomadsoft.cortex.infrastructure.hibernate.HibernateCountryRepository.getById(HibernateCountryRepository.java:26)
> at com.nomadsoft.cortex.domain.country.basic.BasicCountryService.getCountry(BasicCountryService.java:34)
> etc etc
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list