add optimistic locking for savings account

This commit is contained in:
Vishwas Babu A J
2014-12-02 13:24:55 -08:00
parent 78b6f2a3e6
commit f58fc1c116
2 changed files with 6 additions and 0 deletions
@@ -49,6 +49,7 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;
import javax.persistence.Version;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
@@ -105,6 +106,9 @@ import com.google.gson.JsonArray;
@DiscriminatorValue("100")
public class SavingsAccount extends AbstractPersistable<Long> {
@Version
int version;
@Column(name = "account_no", length = 20, unique = true, nullable = false)
protected String accountNumber;
@@ -0,0 +1,2 @@
ALTER TABLE `m_savings_account`
ADD COLUMN `version` INT(15) NOT NULL DEFAULT '1' AFTER `on_hold_funds_derived`;