I guess I m doing something wrong. Please enlighten me what it is I am doing wrong.

I have a class with number of fields.  One of which is boolean.

@Entity
class A {
...
@Basic
boolean         foo;
...
}

OpenJPA doing wonderful job of retrieving "state" of the objects of this class (including 'foo' field). What puzzles me is that it seems to fail to do "opposite". Somewhere else in my code I have


...
        _tx.begin();
                A a = getA();
                a.foo = !a.foo;
        _tx.commit();
...

It looks similar enough to examples from documentation, but it does not work. I am quite confident that "a" is in "attached" state when I am trying to change "condition" field (_em.contans(a ) returns true ). What makes me really puzzled is that if I change code like this:


@Entity
class A {
 ...
 @Basic
 boolean                foo;
 ...
 public void setFoo( boolean v ) {
   this.foo = v;
 }
}


...
        _tx.begin();
                A a = getA();
                a.setFoo( ! a.foo );
        _tx.commit();
...

        
To complete picture, I should mention that I am running "outside of container" (stand alone application).

Any help will be highly appreciated.

Andrei

Reply via email to