This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes HQL converting problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "HQL converting problem" Watch "HQL converting problem" New topic

HQL converting problem

Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
this is my main class

this is Eror

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

Victor Dolirio
Ranch Hand

Joined: Aug 21, 2008
Posts: 57
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:

If happen something bad in you life, don't ask God why it happened. Ask for what.
SCJP 5 (80%) - SCWCD 5 (91%) - SCBCD & SCJD coming soon...
Charan kumar sarvepalli
Ranch Hand

Joined: Dec 14, 2008
Posts: 40

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[].

-- Charan
I agree. Here's the link:
subject: HQL converting problem
Similar Threads
Casting problem
Generics - need help
Database change without update
How to cast an Object to a HashMap with out getting unchecked cast warning
Delete Query problem: Failure to Commit HQL Delete Transaction