• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help required for hibernate query (HQL) calling stored procedure  RSS feed

Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.

Raminder Singh

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!