aspose file tools*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
It is sorta covered in the JavaRanch Style Guide.
subject: HQL converting problem
Similar Threads
Generics - need help
Casting problem
Database change without update
Delete Query problem: Failure to Commit HQL Delete Transaction
How to cast an Object to a HashMap with out getting unchecked cast warning