Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is ORM (hibernate, JPA) Effective for calling Stored Procedures?

 
Siegfried Heintze
Ranch Hand
Posts: 408
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've used JPA and hibernate when I had control over the database and could automate the propagation of my changes to my java code to the database. Very cool.
Put let us suppose that I need to use stored procedures for CRUD in my new project. Is ORM (hibernate or JPA) going to be as effective? I've never called stored procedures from java before and the JDBC examples I have seen look extremely tedious. Can an ORM make calling stored procedures easier? Is there some other technology -- should I consider iBatus?

Thanks
Siegfried
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simplifying calling stored procedures is not a problem ORM's set out to address. You can call stored procedures with an ORM but it tends to be more restrictive then straight JDBC, depending out how complex your SPROC is. I think if your CRUD stuff is going to be all stored procedures I would not choose an ORM.

Anyways here is an example how to with Hibernate, other ORM implementations have similar features.
http://www.mkyong.com/hibernate/how-to-call-store-procedure-in-hibernate/
http://docs.jboss.org/hibernate/orm/3.6/reference/en-US/html/querysql.html#sp_query
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic