There isn't really anything in HQL to replace the returning clause in SQL. Executing UPDATE statements in a query in bernate is usually avoided. It breaks the caches, alters entity fields without rolling the version number, hoses the in memory state of your session, and is generally bad juju.
Normally in a hibernate application you'd only use an update query for large batch operations where the performance consequences of using the Session normally are just too much.
There isn't really anything in HQL to replace the returning clause in SQL. Executing UPDATE statements in a query in bernate is usually avoided. It breaks the caches, alters entity fields without rolling the version number, hoses the in memory state of your session, and is generally bad juju.
Normally in a hibernate application you'd only use an update query for large batch operations where the performance consequences of using the Session normally are just too much. If you're doing this with high enough frequency that locking the entity prior to the update is an issue, the native sql probably is your best option. I wouldn't personally worry about it until it's proven to be a problem.
You're not really doing that much extra work in the DB cursor to select for update the things you're about to update, but I am not a postgres expert either.
I suspect that you are right and that I am trying to prematurely optimize here. For now I'm going to go with the locking option. They should all be very short-lived, if it becomes a problem later I'll address it then.
Thanks for the input. – Jafoy Apr 21 at 13:29.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.