Added optimistic locking to AbstractEntity and fixed problem form table.