aspose file tools
The moose likes Object Relational Mapping and the fly likes hibernate error Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "hibernate error" Watch "hibernate error" New topic
Author

hibernate error

Amirtharaj Chinnaraj
Ranch Hand

Joined: Sep 28, 2006
Posts: 215
hi guys iam facing an error
while casting a collection

below shows the code




below shows the stack trace

Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

What kind of Set does getProductTracks() return? What HashSet have you imported into your class? A Hibernare PersistentSet does not extend HashSet, so you can't cast from one to the other.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Amirtharaj Chinnaraj
Ranch Hand

Joined: Sep 28, 2006
Posts: 215
getProductTracks() returns Collection
but i have tried with casting ArrayList also iam getting the same error

thanks
amir
[ April 23, 2008: Message edited by: Amirtharaj Chinnaraj ]
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

So why is dbTrackCollections defined as a HashSet? Chould it not be a Collection too?
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4967

Run a getClass() method call on the object before the cast and see what object type is being returned. It may not be what you expect!

-Cameron McKenzie


Author of Hibernate Made Easy, What is WebSphere???, JSF 2.0 Made Easy and the SCJA Certification Guides
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: hibernate error
 
Similar Threads
preparedstatement throws sqlexception
Error while using lookup
exception when it reach tiles:insert tag ??
DisplayTag & dynamic pagesize
Struts error cannot find bean