Hi,

I'm not sure if this question belongs here, but thought it might have been
something that others came along too.

I have a Tapestry application using Hibernate. Now I am trying to add
Hibernate's optimistic locking using a Timestamp.

In my Tapestry page I have an activation context to retrieve the right
Person object.

Index.class

public class Index {

        @Inject
        private PersonRepository personRepo;
        
        @Property
        private Person person;
        
        @Persist("flash")
        @Property
        private String person;
        
        @SetupRender
        void setup() {
                name = person.getName();
        }
        
        @CommitAfter
        void onSuccess() {
                person.setName(name);
        }
        
        void onActivate(Integer personId) {
                person = personRepo.get(personId);
        }
        
        Integer onPassivate() {
                return person.getId();
        }
}

Index.tml:

<t:form>
  <t:textfield t:value="name" />
  <t:submit />
</t:form>

When I open up this page in 2 browsers to test optimistic concurrency,
update the name in the first browser and after that in the second I need to
get an error because an update on this object has been committed after
opening this page.
When I submit the form it will always first get the Person object again
through onActivate so I understand why this isnt working. I'm just asking if
someone has ideas, pointers on how I should handle this.

Nathan



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Tapestry-Hibernate-optimistic-locking-tp5718413.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to