-
1. Re: Understand Seam Transaction vs EJB transaction
pmuir May 12, 2008 7:21 PM (in response to paradigmza.sean.healthbridge.co.za)Hmm, I think you are right. File an issue in JIRA, I need to think about this a bit.
-
2. Re: Understand Seam Transaction vs EJB transaction
nuuh Sep 1, 2010 6:58 AM (in response to paradigmza.sean.healthbridge.co.za)Hi,
We have a project and we have customers and users..
one user opend a customer account (page) for change and write new staff about customer if one of the other users open the same customer and change, first users changing ll be lost..
so i need a system for not lose the changing.. like if one user select a customer, this customer object ll be lock.. i thing this transaction for what i need right??
i didnt understand how to use transactions in my project..
if you now something (links) can you write.. :)
thanks all..
-
3. Re: Understand Seam Transaction vs EJB transaction
njrich28 Sep 1, 2010 1:04 PM (in response to paradigmza.sean.healthbridge.co.za)This sounds more like locking than transactions. If you're using Hibernate or JPA then have a look at 'optimistic locking' using the @Version annotation.
You basically specify one field of Customer class as a version field
private @Version Long version;
Hibernate/JPA will then increment the version field every time it updates the row in the database. When it updates the field it checks that the version in the database is the same as the one it loaded - if it's different then it knows that the row has been updated by another user/process and throws an exception.
It's very efficient and doesn't require any actual locks in the database but prevents users from overwriting changes made by other users.