-->
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.  [ 1 post ] 
Author Message
 Post subject: Loading and Saving via Long PK when Mapping says Integer
PostPosted: Thu Jul 07, 2005 1:31 pm 
Beginner
Beginner

Joined: Thu Nov 20, 2003 1:30 pm
Posts: 27
3.0.5

This was hard to debug...

In the mapping I have a class who's primary key is an Integer. In the code I loaded the class (Status) by giving it a Long. (Obviously this is wrong, but someone used Long by mistake, the class loaded fine)
When I would set Status onto Member and session.save(Member) I get the following exception.

It was hard to debug this because it did not say with what class or any information to point to what I found. (I debugged it by flushing everything after each statement and took it from there)

Now, I'm wondering if this is just an inconsistency or what. Because if you are allowed to load a class via a Long then you should be able to save that way. Yes?


2005-07-07 11:53:56,134 ERROR com.lsr.swing.moat.MOAT - rollback
java.lang.ClassCastException at org.hibernate.type.IntegerType.set(IntegerType.java:39) at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:62) at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:39) at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:63) at org.hibernate.persister.entity.BasicEntityPersister.dehydrate(BasicEntityPersister.java:1617) at org.hibernate.persister.entity.BasicEntityPersister.dehydrate(BasicEntityPersister.java:1594) at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1850) at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2200) at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:46) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223) at org.hibernate.engine.ActionQueue.executeInserts(ActionQueue.java:127) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:196) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:160) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:95) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184) at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173) at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:481) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:476) at com.lsr.framework.panel.database.dao.PanelistDAO.persistPanelist(PanelistDAO.java:107) at com.lsr.framework.panel.database.dao.PanelistDAO.uploadPanelist(PanelistDAO.java:75) at com.lsr.swing.moat.MOAT$35.run(MOAT.java:841) at java.lang.Thread.run(Thread.java:534)


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

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.