wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Is ORM (hibernate, JPA) Effective for calling Stored Procedures? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Is ORM (hibernate, JPA) Effective for calling Stored Procedures?" Watch "Is ORM (hibernate, JPA) Effective for calling Stored Procedures?" New topic
Author

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

Siegfried Heintze
Ranch Hand

Joined: Aug 11, 2000
Posts: 388
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

Joined: Mar 07, 2010
Posts: 1676
    
    7

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

[How To Ask Questions][Read before you PM me]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is ORM (hibernate, JPA) Effective for calling Stored Procedures?