-->
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.  [ 3 posts ] 
Author Message
 Post subject: ClassCastException in unsorted set that uses TreeSet?
PostPosted: Mon Aug 16, 2004 6:34 am 
Beginner
Beginner

Joined: Wed Sep 17, 2003 10:43 am
Posts: 48
Hi,

Can someone please open my eyes and tell me why I'm getting this classcast exception? Also why hibernate is using a sorted set (TreeSet) since my mapping says it's unsorted?

Hibernate version:
2.1.4
Mapping document (fragment):
<set name="participationCriteria" lazy="true" inverse="true" cascade="none" sort="unsorted" batch-size="1" outer-join="auto">
<key>
<column name="f_participation_criteria"/>
</key>
<one-to-many class="eu.dgentr.ida.eproc.common.pojo.ParticipationCriterionVO"/>
</set>

code:
pcVO.getParticipationCriteria().add(pcnVO);

Exception:
13:07:44,031 INFO [STDOUT] java.lang.ClassCastException: eu.dgentr.ida.eproc.common.pojo.ParticipationCriterionVO
13:07:44,031 INFO [STDOUT] at java.util.TreeMap.compare(TreeMap.java:1085)
13:07:44,031 INFO [STDOUT] at java.util.TreeMap.put(TreeMap.java:463)
13:07:44,031 INFO [STDOUT] at java.util.TreeSet.add(TreeSet.java:209)
13:07:44,031 INFO [STDOUT] at eu.dgentr.ida.eproc.call4tenders.presentation.EditParticipationConditionsAction.addParticipationCondition(U
13:07:44,031 INFO [STDOUT] at eu.dgentr.ida.eproc.call4tenders.presentation.EditParticipationConditionsAction.execute(Unknown Source)
13:07:44,031 INFO [STDOUT] at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:462)
13:07:44,031 INFO [STDOUT] at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:267)
13:07:44,031 INFO [STDOUT] at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1187)
13:07:44,031 INFO [STDOUT] at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:451)
13:07:44,031 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
13:07:44,031 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
13:07:44,031 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
13:07:44,031 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
13:07:44,031 INFO [STDOUT] at eu.dgentr.ida.eproc.authorization.presentation.SecurityFilter.doFilter(Unknown Source)
13:07:44,031 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
13:07:44,031 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
13:07:44,031 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
13:07:44,031 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
13:07:44,046 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
13:07:44,046 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
13:07:44,046 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
13:07:44,046 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
13:07:44,046 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:72)
13:07:44,046 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
13:07:44,046 INFO [STDOUT] at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:275)
13:07:44,046 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
13:07:44,046 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
13:07:44,046 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
13:07:44,046 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
13:07:44,046 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
13:07:44,046 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
13:07:44,046 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
13:07:44,046 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
13:07:44,046 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
13:07:44,046 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
13:07:44,046 INFO [STDOUT] at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
13:07:44,046 INFO [STDOUT] at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
13:07:44,046 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
13:07:44,046 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
13:07:44,046 INFO [STDOUT] at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
13:07:44,046 INFO [STDOUT] at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
13:07:44,046 INFO [STDOUT] at java.lang.Thread.run(Thread.java:534)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 16, 2004 7:38 am 
Beginner
Beginner

Joined: Wed Sep 17, 2003 10:43 am
Posts: 48
The problem is spolved when the POJOs implement Comparable, but still I cannot figure out why hibernate uses an implementation of SortedSet for the above mapping.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 16, 2004 7:40 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Try 2.1.6, IIRC, that might be a fixed bug.

Or remove sort="unsorted".


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