Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Mapping - Object cannot be cast to

 
Zoltan Tailor
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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,


 
K. Tsang
Bartender
Posts: 3585
16
Android Java
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic