Issue #1561: ObjectDB enhancement fails on "is" form for @Transient boolean isLoaded(), ok for "getter" form @Transient boolean getLoaded()

Type: Bug ReoprtVersion: 2.4.0Priority: NormalStatus: FixedReplies: 1
#1

Older objectdb-2.4.0_06, Java6.

For the following (note the use of "is" form) in a class Element I encounter ObjectDB enhancement errors:

    private boolean loaded = false;

    @Transient
    @Override
    public boolean isLoaded() {
         return loaded;
    }

    @Override
    public void setLoaded(boolean loaded) {
         this.loaded = loaded;
    }

No matter whether using javaagent run-time enhancement or post-compile enhancement, and on complete clean and build in NetBeans, and also after complete NetBeans cache clear (an no matter whether using compile-on-save or not) I get at run-time this error (and for every subclass entity):

INFO: [2014-11-23 16:54:03 #2 type]
Type com.example.entity.Element is not enhanced.
...

But it is ok using the 'get' getter form:

    private boolean loaded = false;

    @Transient
    @Override
    public boolean getLoaded() {
         return loaded;
    }

    @Override
    public void setLoaded(boolean loaded) {
         this.loaded = loaded;
    }

I don't have time to offer an isolated test case, but I found the result reproducible.

According to this example from the p.96  of JSR-317 Final Release, the 'is' form should be acceptable:

@Entity
@EntityListeners(com.acme.AlertMonitor.class)
public class Account {
 Long accountId;
 Integer balance;
 boolean preferred;
 @Id
 public Long getAccountId() { ... }
  ...
  public Integer getBalance() { ... }
  ...
  @Transient // because status depends upon non-persistent context
  public boolean isPreferred() { ... }
  ...

Although some of your online docs refer to JavaBeans set and get methods (such as http://www.objectdb.com/java/jpa/entity/fields), I have not found anywhere yet that says ObjectDB does not support 'is' style accessors.

Could you please clarify, and confirm whether ObjectDB is supposed to support 'is' accessors ?

#2

Thank you for this report. We can confirm that annotations on "is" methods of boolean persistent JavaBean properties have been ignored by ObjectDB after enhancement due to an internal issue.

Build 2.5.7_06 includes a fix.

ObjectDB Support

Reply