• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate and stored procedure

 
azhar bharat
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it good to use hibernate in an application which is highly dependent on stored procedures?
Is there any disadvantage in using hibernate in such a scenario?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd say no. Hibernate can support Stored Procedures but Stored Procedures are implicitly database dependent (since thats where they live) so putting an ORM in front of them doesn't make a great deal of sense. That is unless your evental goal is to make your application portable and slowly phase out the SPs?

Hibernate wont be a great disadvantage in this case. All you are doing is replacing one type of boiler plate code (JDBC) with another (Hibenrate) to no great imediate benefit.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll take the opposite opinion from Paul, simply from the fact that if you have Stored Procedures without Hibernate, you will have lots of JDBC code that translates the return results from stored procedures into your Java classes, which I always find error prone and harder to maintain.

That said, there is still lots of merit to Paul's post. For instance, there are lots of ways to get better performance out of Hibernate than through a stored procedure with Caching. And I find that an all SP solution is not flexible, maintainable, and leaves you vendor locked as Paul has said.

Personally, in today's technology, those people that fight for an all SP solution are out of date.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic