-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Class Cast Exception Integer to BigDecimal
PostPosted: Wed Aug 14, 2013 2:18 am 
Newbie

Joined: Fri Aug 02, 2013 8:24 am
Posts: 9
Hello,

I am getting class cast exception "java.lang.Integer cannot be cast to java.math.BigDecimal".
I had my application running on Hibernate - SQL server combination.
I am currently migrating it to Oracle.

I regenerated all the HBM file. and now running application I get following error.

java.lang.Integer cannot be cast to java.math.BigDecimal
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.math.BigDecimal
at org.hibernate.type.BigDecimalType.isEqual(BigDecimalType.java:44)
at org.hibernate.type.NullableType.isEqual(NullableType.java:160)
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:57)
at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:157)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:113)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:196)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:35)
at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1562)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at org.springframework.orm.hibernate3.HibernateTemplate$36.doInHibernate(HibernateTemplate.java:1056)
at org.springframework.orm.hibernate3.HibernateTemplate$36.doInHibernate(HibernateTemplate.java:1)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.findByCriteria(HibernateTemplate.java:1046)
at org.springframework.orm.hibernate3.HibernateTemplate.findByCriteria(HibernateTemplate.java:1039)
at com.dao.impl.PersistenceManagerHibernateImpl.findByDetachedCriteria(PersistenceManagerHibernateImpl.java:163)


I all POJO classes generated along with HBM files have BigDecimal as data type for primary key.
While passing criteria for "findByDetachedCriteria" method I am passing two criteria.
one is String
and another one is instance of POJO class which again has primary key as BigDecimal.
I am not at all passing any integer value.

Can anyone please guide me on this?


Top
 Profile  
 
 Post subject: Re: Class Cast Exception Integer to BigDecimal
PostPosted: Tue Aug 20, 2013 7:04 am 
Newbie

Joined: Fri Aug 02, 2013 8:24 am
Posts: 9
I made a blunder by manipulating POJO classes initially.
Later on I revered it back but missed out couple of classes hence got the error.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.