Quote:
1) is there an easier solution than mine
I am afraid there is no easier solution. See these, they may give you some pointers.
http://opensource.atlassian.com/project ... e/HHH-2060http://forum.hibernate.org/viewtopic.php?p=2374438Quote:
2) which possibilities do I have to avoid problems with concurrent threads? (Let’s say worker A reads the last number for section “france” and worker B does the same exactly the same moment. Both sessions increase the counter by one and try to save their new orders. The second one will get an exception.)
I think in a loop you can keep on trying incrementing the count till the save is successful.