This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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 Android Security Essentials Live Lessons this week in the Android 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
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: HQL converting problem
Similar Threads
How to cast an Object to a HashMap with out getting unchecked cast warning
Delete Query problem: Failure to Commit HQL Delete Transaction
Database change without update
Casting problem
Generics - need help