| 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
|
 |
 |
|
|
subject: hibernate error
|
|
|