Re: Rolling back changes in ROP does seem to work

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Sep 04 2008 - 07:43:18 EDT

  • Next message: Ian Boston: "ClassCastException, Cayenne 2.0.4"

    Hi Tarik,

    You are right, this is a bug in Cayenne. I can reproduce it. Let me
    Jira it and see what we can do.

    Andrus

    On Sep 1, 2008, at 10:10 PM, Tarik wrote:

    > I'm trying to roll back a transaction in ROP but strangely, none of
    > changed
    > values get reverted. Am I missing something basic or is rolling back
    > changes on ROP broken?
    >
    > This is what I'm doing:
    >
    > ClientConnection connection = new HessianConnection("http://" +
    > server
    > + "/cayenne-service", "cayenne-user", "secret", null);
    >
    > DataChannel channel = new ClientChannel(connection);
    >
    > ObjectContext context = new CayenneContext(channel);
    >
    > Contact contact = context.newObject(Contact.class);
    >
    > contact.setFirstName("Joe");
    >
    > context.commitChanges();
    >
    > System.out.println("1. persistence state=
    > "+contact.getPersistenceState()+" first
    > name="+contact.getFirstName());
    >
    > contact.setFirstName("Jack");
    >
    > System.out.println("2. persistence state=
    > "+contact.getPersistenceState()+" first
    > name="+contact.getFirstName());
    >
    > context.rollbackChanges();
    >
    > System.out.println("3. persistence state=
    > "+contact.getPersistenceState()+" first
    > name="+contact.getFirstName());
    >
    > Output:
    > 1. persistence state= 3 first name=Joe
    > 2. persistence state= 4 first name=Jack
    > 3. persistence state= 3 first name=Jack
    >
    > Thanks



    This archive was generated by hypermail 2.0.0 : Thu Sep 04 2008 - 07:43:57 EDT