ODB with Netbeans

#1

ODB2 allows JPA attributes to be public (which is great), but JPA does not.

So, in Netbeans, with attributes like this:

@Entity class A
{
    public String name;
}

I get compile time errors "Instance variable for persistent attribute must not be public"

How does one switch that off in Netbeans?

 

#2

NetBeans generates several errors/warnings, which are not considered as errors by ObjectDB, including:

  • "An entity class must be public."
    This is a NetBeans restriction, not a JPA restriction.
  • "An entity or IdClass class should implement the java.io.Serializable interface."
    This is also a NetBeans restriction, not a JPA restriction.
  • "There is no ID defined for this entity hierarchy."
    JPA requires an ID field, ObjectDB doesn't.
  • "An entity class may not be final."
    This is a JPA restriction. ObjectDB supports also final entity classes.
  • "The project does not contain a persistence unit."
    This is a JPA requirement. Persistence units are optional in ObjectDB.
  • "Instance variable for a persistent attribute must not be public."
    This is another JPA restriction, which is not enforced by ObjectDB, but is highly recommended.

I don't know whether it is possible or not to to disable these errors/warnings. Maybe this question should be discussed in a NetBeans forum. I didn't find these errors in Tools > Options > Editor > Hints > Java.

However, please notice that you may ignore all these errors/warnings since even the errors are not compilation errors, so you can still build and run the project.

ObjectDB Support

Reply