Reputation: 21390
I have a class
@Entity
public class MyClass extends BaseClass {
...
public boolean isOpenAt(Date x) {
return true; // or whatever
}
}
@MappedSuperclass
@Access(AccessType.Field)
public abstract class BaseClass {
...
}
Running mvn datanucleus:enhance
I get the error org.datanucleus.metadata.InvalidClassMetaDataException: "MyClass.openAt" : declared in MetaData, but this field doesnt exist in the class!
Any idea why?
I'm using org.datanucleus:datanucleus-core:3.2.7, org.datanucleus:datanucleus-accessplatform-jpa-rdbms:3.3.2, org.eclipse.persistence:javax.persistence:2.1.0, org.datanucleus:datanucleus-maven-plugin:3.3.0-release.
Upvotes: 0
Views: 175
Reputation: 6969
Disclaimer: I have no idea what datanucleus is.
That said, it's likely that isOpenAt()
method gets treated as a getter (similar to getFirstName()
, say), since according to According to the JavaBeans spec,
Boolean properties
In addition, for boolean properties, we allow a getter method to match the pattern:
public boolean is<PropertyName>();
This "isPropertyName" method may be provided instead of a "get" method, or it may be provided in addition to a "get" method. In either case, if the is method is present for a boolean property then we will use the "is" method to read the property value. An example boolean property might be:
public boolean isMarsupial(); public void setMarsupial(boolean m);
Try renaming isOpenAt()
into seeIfOpenAt()
and see if that helps.
Upvotes: 1