374 words

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

BugVersion: 2.4.0Priority: NormalStatus: FixedReplies: 1
#1
2014-11-22 09:19

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 ?

--- Webel IT Australia, "The Elements of the Web", Specialists in model-based UML, SysML, Enterprise Java, XML, and Drupal CMS web engineering. Dr Darren Kelly, BSc, PhD, https://www.webel.com.au
webel
webel's picture
Joined on 2011-05-27
User Post #65
#2
2014-11-24 17:29

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
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,090

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Attachments:
Maximum file size: 32 MB
Cancel