-->
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.  [ 4 posts ] 
Author Message
 Post subject: Class Case doing update
PostPosted: Thu Jul 07, 2005 9:20 am 
Beginner
Beginner

Joined: Sun Aug 22, 2004 5:32 pm
Posts: 40
I am getting a class cast exception when I try to edit an object in memory, which was pulled from the database. The exception is thrown when I call some of the setter methods in the bean, which was generated from the mapping file. Does anyone have any suggestions in how to troubleshoot this issue? Thanks.

Here is the error:

5_0_, casevo1_.Case_Last_Update_SO_User_Cd as Case_La16_0_, casevo1_.Case_Batch_
Id_Nbr as Case_Ba17_0_ from subject subjectvo0_, GDCS_Case casevo1_ where subjec
tvo0_.Subj_Id_Nbr=? and subjectvo0_.Case_Sequence_Nbr=casevo1_.Case_Sequence_Nbr
(+) and subjectvo0_.Agency_State_Cd=casevo1_.Agency_State_Cd(+)
[java] Jul 7, 2005 9:09:02 AM net.sf.hibernate.proxy.LazyInitializer initia
lizeWrapExceptions
[java] SEVERE: Exception initializing proxy
[java] java.lang.ClassCastException
[java] at net.sf.hibernate.type.IntegerType.set(IntegerType.java:34)
[java] at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.j
ava:48)
[java] at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.j
ava:35)
[java] at net.sf.hibernate.loader.Loader.bindPositionalParameters(Loade
r.java:753)
[java] at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.j
ava:793)
[java] at net.sf.hibernate.loader.Loader.doQuery(Loader.java:269)
[java] at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCol
lections(Loader.java:138)
[java] at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:941)
[java] at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:961)
[java] at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:5
9)
[java] at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:5
1)
[java] at net.sf.hibernate.persister.EntityPersister.load(EntityPersist
er.java:413)
[java] at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:213
1)
[java] at net.sf.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.j
ava:1945)
[java] at net.sf.hibernate.proxy.LazyInitializer.initialize(LazyInitial
izer.java:53)
[java] at net.sf.hibernate.proxy.LazyInitializer.initializeWrapExceptio
ns(LazyInitializer.java:60)
[java] at net.sf.hibernate.proxy.LazyInitializer.getImplementation(Lazy
Initializer.java:164)
[java] at net.sf.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLa
zyInitializer.java:108)
[java] at gov.treasury.fincen.bsadirect.gdcs.vo.SubjectVO$$EnhancerByCG
LIB$$7a789eba.setSubjAliasFirstNm(<generated>)
[java] at gov.treasury.fincen.bsadirect.gdcs.tests.CaseDAODriver.main(C
aseDAODriver.java:190)
[java] net.sf.hibernate.LazyInitializationException: Exception initializing
proxy: [gov.treasury.fincen.bsadirect.gdcs.vo.SubjectVO#gov.treasury.fincen.bsa
direct.gdcs.vo.CaseNumberVO@d56b37[caseSequenceNbr=12343,agencyStateCode=NY]]
[java] at net.sf.hibernate.proxy.LazyInitializer.initializeWrapExceptio
ns(LazyInitializer.java:64)
[java] at net.sf.hibernate.proxy.LazyInitializer.getImplementation(Lazy
Initializer.java:164)
[java] at net.sf.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLa
zyInitializer.java:108)
[java] at gov.treasury.fincen.bsadirect.gdcs.vo.SubjectVO$$EnhancerByCG
LIB$$7a789eba.setSubjAliasFirstNm(<generated>)
[java] at gov.treasury.fincen.bsadirect.gdcs.tests.CaseDAODriver.main(C
aseDAODriver.java:190)
[java] Caused by: java.lang.ClassCastException
[java] at net.sf.hibernate.type.IntegerType.set(IntegerType.java:34)
[java] at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.j
ava:48)
[java] at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.j
ava:35)
[java] at net.sf.hibernate.loader.Loader.bindPositionalParameters(Loade
r.java:753)
[java] at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.j
ava:793)
[java] at net.sf.hibernate.loader.Loader.doQuery(Loader.java:269)
[java] at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCol
lections(Loader.java:138)
[java] at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:941)
[java] at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:961)
[java] at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:5
9)
[java] at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:5
1)
[java] at net.sf.hibernate.persister.EntityPersister.load(EntityPersist
er.java:413)
[java] at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:213
1)
[java] at net.sf.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.j
ava:1945)
[java] at net.sf.hibernate.proxy.LazyInitializer.initialize(LazyInitial
izer.java:53)
[java] at net.sf.hibernate.proxy.LazyInitializer.initializeWrapExceptio
ns(LazyInitializer.java:60)
[java] ... 4 more
[java] Exception in thread "main"
[java] Java Result: 1

_________________
Scott
www.HikeHaven.com


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 07, 2005 11:13 am 
Beginner
Beginner

Joined: Wed Jul 06, 2005 8:18 pm
Posts: 23
Double-check the type in your mapping file with your class property, make sure they're compatible. Same thing with your queries.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 07, 2005 12:28 pm 
Beginner
Beginner

Joined: Sun Aug 22, 2004 5:32 pm
Posts: 40
This is a weird issue because it happens with any setter method in the class. I am just using strings, which map as varchar in the oracle database.

I am wondering if the issue has to do with the fact I am using a composite key on a different class as a foreign key in the class I am trying to update.

I verified all the types and they are correct.

I am calling the following method:
subjectVO = subjectDAO.getSubjectByCaseNumber(caseNumberVO);
this don't throw an error.

The error is thrown when I call the following on the subjectVO:
subjectVO.setSubjectCityNm("some new string");

_________________
Scott
www.HikeHaven.com


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 07, 2005 1:11 pm 
Beginner
Beginner

Joined: Sun Aug 22, 2004 5:32 pm
Posts: 40
hacktorious wrote:
This is a weird issue because it happens with any setter method in the class. I am just using strings, which map as varchar in the oracle database.

I am wondering if the issue has to do with the fact I am using a composite key on a different class as a foreign key in the class I am trying to update.

I verified all the types and they are correct.

I am calling the following method:
subjectVO = subjectDAO.getSubjectByCaseNumber(caseNumberVO);
this don't throw an error.

The error is thrown when I call the following on the subjectVO:
subjectVO.setSubjectCityNm("some new string");


For some reason it only happens when I do a query to select a record with the specified primary key.

_________________
Scott
www.HikeHaven.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.