This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Creating a Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Creating a "stored procedure" with HIbernate" Watch "Creating a "stored procedure" with HIbernate" New topic
Author

Creating a "stored procedure" with HIbernate

Alex Bognetz
Greenhorn

Joined: Apr 17, 2009
Posts: 2
Hi all

I know that there is a way to call a stored procedure by Hibernate.
Is there a way to create a stored procedure as well?

I need to create a stored procedure dynamically in Pl/PsgSQL and then storing it the db with hibernate.

Example:
I have a form with a text area so a user can write pl/PsgSql code inside
When the user submits the form , the code has to be stored as a procedure in the db.
I'd would be great if I could check also the pl/PsgSql syntax, if possible.

Anyone can help me?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Hibernate supports native queries. Just use them.

As for PL/SQL syntax, Hibernate can't do that. You can either display any SQL error that comes back or you could use something like antlr with a PL/SQL grammar.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Creating a "stored procedure" with HIbernate