• Post Reply Bookmark Topic Watch Topic
  • New Topic

stored procedure  RSS feed

 
tibi stibi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi list,

i have some examples how i can call a stored procedure with hibernate. these are done with namedqyeries.
at the moment is only use annotation and no hibernate files.
is it possible to call something like this:

getHibernateTemplate().find("{?= call TEST(?)}", new Object[] {
name});
which will return a cursor or multiple rows with all the users found with name 'name'.

thanks,

tibi
 
Campbell Ritchie
Sheriff
Posts: 54034
130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"tibi stibi" welcome to JavaRanch.

You will doubtless have seen we have a naming policy which helps to maintain the friendly atmosphere, which requires real names be displayed.
Please confirm that is your real name.
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No you cannot.

take the example syou have and where the named query is defined, just use it with the @NamedQuery annotations. Same difference, basically.

That is the only way you will be able to use a stored procedure.

And remember the rules

1. Only one out parameter allowed
2. the out parameter must be the first parameter
3. Only reference cursors are allowed as the out parameter.
4. Stored Procedures will only work for you when you change your display name to meet the JavaRanch Naming Policy.

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