Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stored Procedure with Hibernate

 
Padma Prasad
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does Hibernate provide support for stored procedure? kind of callable statement? I need this to have a query performed over a set of variables and return the result. I dont want to query for each variable. I cannot have a one-many mapping because this is a huge table and i want only few rows n columns of it. so, cannot have this mapping.
Thanks,
Padma.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i want only few rows n columns of it

Hibernate will let you specify how many rows to return - have a look at the Query object's setMaxResults(int rows) method. Hibernate just picks whatever DB specific piece of proprietory SQL it needs to call to do this.
With regards to SP support, have a look at the Query object's createSQLQuery() method. Of course once you start using SPs, with their propritory syntax you remove Hibernate's DB protablitlity.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic