File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Help required for hibernate query (HQL) calling stored procedure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Help required for hibernate query (HQL) calling stored procedure" Watch "Help required for hibernate query (HQL) calling stored procedure" New topic
Author

Help required for hibernate query (HQL) calling stored procedure

Raminder Singh
Ranch Hand

Joined: Mar 01, 2002
Posts: 72
Hi,

I need some help on resolving below issue in hibernate queries (HQL) calling a stored Procedure (using MySQL DB).

Stored Procedure name is proc_name
Sample Query executing in procedure is:

Declaration in hibernate:

Now issue is that:
- Return data from procedure is [all the columns from Table1] and [a additional scalar data].
- Used below code in java to execute procedure

Now how to get the data back from query.list()?

- I am trying to create a new class Table2 extended from Table1 with a new property distance and then using Is this correct? I'm getting an error for unknown id via hbm file? IfTable1.java is mapped to Table1 via hbm file do we still need to create a hbm for table2 which i doubt.

- how to use setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP) here?

- Can I directly use and wish that both the data (columns of Table1 & additonal scalar data) will be available? I'm able to get 2 objects in list 'result' but casting from object to Table2 getting failed.

Please suggest the correct approach.


Regards,
Raminder Singh

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help required for hibernate query (HQL) calling stored procedure
 
Similar Threads
Hibernate; error executing stored procedure
Strange Hibernate issue..
Hibernate: Different Join in Save() and Get()
Help required for hibernate query (HQL) calling stored procedure
Hibernate is not recognizing SQL's 'FREETEXT' keyword