To quote from the hibernate docs this is an area that they need to work on. It says:
Warning
This is an area in Hibernate in need of improvement. In terms of portability concerns, this function handling currently works pretty well from HQL; however, it is quite lacking in all other aspects.
This is my eventual solution.
First off a Dao class
Here is the interface that the Dao will implement
Then the generic Dao MetOfficeDao
Note the following:
- The use of ResultSetHandler from Apache is a basic ORM
- JDBC parameters start from '1'
- getSession().connection(); is deprecated
Just for completeness - here is an example stored procedure for SQLServer
Note the line:
SET NOCOUNT ON
This is needed so that the procedure just returns the data and not the number of rows returned
No comments:
Post a Comment