warning: if your strored procedure update records, the session will not be uptodate with the updates objects !!
If you want to avoid the problem:
1- get a session
2- do what you have to do with your objects
3- flush & commit
4- session.clear
5- session.getConnection --> you need this to call your strored procedure
6- after this you can reuse your session
Note that if your strored procedure return "rows" and you want to use the rows as "business objects" by using the setters, you're going into troubles...
HQL let you call complexe objects queries, and if you use HQL you don't have to worry about your object's persistence.
But if you need to use a strored procedure to return a "very complex" query, this only mean that your domain model or your database model is wrong....
|