• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate Mapping - Object cannot be cast to

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

Here is my Options.hbm.xml, Options.java and ConfigurationLoader.java. The ConfigurationLoader fails because it throws an exception here: option = (Options)lists.get(i);
Its: "java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to database.Options".

What can be the problem?

Thanks,


 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you try declaring and casting your list as List<Option>?



Then you don't need to cast it again in the for loop.
 
Zoltan Tailor
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

K. Tsang wrote:Did you try declaring and casting your list as List<Option>?



Then you don't need to cast it again in the for loop.



Thanks, unfortunately it does not work this way but a friend of mine suggested to change the HQL just simply to: "FROM options", and that did the magic!

Thanks anyway it solved
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic