If you are using Stored Procedure for all Database related stuff, then here are few guidelines (for using Java persistence framework for database related stuff).
Stored Procedure is good option to avoid any SQL Injection Attack.
Hibernate is the first option in my mind because of its popularity. At the same time we were going through spring framework documents, so DB connectivity using spring was another option (Using Spring's Stored Procedure class)
But after going through hibernate docs, we realised that, using Hibernate is not possible (with Stored Procedure) because
1 If we are using stored procedures for DB related stuff, hibernate support for Stored Procedure is very limited.
2. Hibernate is better when we want auto generated SQL(Hibernate generated) and where writing custom SQL is not necessary.
We also tried Spring's DB connectivity. But for that we have to create separate class to handle each stored procedure.
We came across another option ie. iBATIS Data Mapper.
(reason : performance of iBATIS is very close to normal JDBC
See link : http://www.devx.com/Java/Article/33768/1954?pf=true )
When we went through documents of iBATIS, it was very close to what we need.
ie. Stored Procedure support of iBATIS is very good as compared to other Java DB persistence frameworks like Hibernate. And one more thing, it is very easy to implement iBATIS in your application. Simplicity is the biggest advantage of the iBATIS Data Mapper over object relational mapping tools.
According to me, iBATIS is a very good option if you are using Stored Procedure and want to use any Java persistence framework.
Hibernate and iBATIS:
iBATIS maps Java objects to the results of SQL Queries, whereas Hibernate maps Java Objects directly to database tables, ie. Object-Relational Mapping.
The benefits of Hibernate are that it automatically generates all the SQL for you and the cache invalidation can be more fine grained. iBATIS is more flexible especially if you are a strong SQL query writer. You have control over exactly how the SQL queries are written.
Stored Procedure is good option to avoid any SQL Injection Attack.
Hibernate is the first option in my mind because of its popularity. At the same time we were going through spring framework documents, so DB connectivity using spring was another option (Using Spring's Stored Procedure class)
But after going through hibernate docs, we realised that, using Hibernate is not possible (with Stored Procedure) because
1 If we are using stored procedures for DB related stuff, hibernate support for Stored Procedure is very limited.
2. Hibernate is better when we want auto generated SQL(Hibernate generated) and where writing custom SQL is not necessary.
We also tried Spring's DB connectivity. But for that we have to create separate class to handle each stored procedure.
We came across another option ie. iBATIS Data Mapper.
(reason : performance of iBATIS is very close to normal JDBC
See link : http://www.devx.com/Java/Article/33768/1954?pf=true )
When we went through documents of iBATIS, it was very close to what we need.
ie. Stored Procedure support of iBATIS is very good as compared to other Java DB persistence frameworks like Hibernate. And one more thing, it is very easy to implement iBATIS in your application. Simplicity is the biggest advantage of the iBATIS Data Mapper over object relational mapping tools.
According to me, iBATIS is a very good option if you are using Stored Procedure and want to use any Java persistence framework.
Hibernate and iBATIS:
iBATIS maps Java objects to the results of SQL Queries, whereas Hibernate maps Java Objects directly to database tables, ie. Object-Relational Mapping.
The benefits of Hibernate are that it automatically generates all the SQL for you and the cache invalidation can be more fine grained. iBATIS is more flexible especially if you are a strong SQL query writer. You have control over exactly how the SQL queries are written.