Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HQL converting problem

 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is my main class


this is Eror


I tried changing 24 line by Integer[] row = (Integer[]) itor.next();
it also give Eooror

 
Victor Dolirio
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Samanthi,

In your hql, you're projecting the ID of the person. This ID is a value of type Integer, just how you mapped that. So you MUST to get it with a variable of Integer type and not an array. Try this on line 23:

 
Charan kumar sarvepalli
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In your HQL in select clause you have only one column defined to return, so the hibernate returns object only.
if you have defined multiple columns in the select clause then definitely it returns object[].

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic