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

hibernate error

Amirtharaj Chinnaraj
Ranch Hand

Joined: Sep 28, 2006
Posts: 236
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: 236
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: 4968
    
    1

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: hibernate error