• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Help required for hibernate query (HQL) calling stored procedure

Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

Every snowflake is perfect and unique. And every snowflake contains a very tiny ad.
a bit of art, as a gift, the permaculture playing cards
    Bookmark Topic Watch Topic
  • New Topic