Issue #2567: com.objectdb.o._PersistenceException: Failed to locate set method for field property using reflection

Type: BugVersion: 2.6.9Priority: LowStatus: ActiveReplies: 3
#1

I am developing a J2SE  version "1.8.0_241" application and using property based accessors throughout.

@Entity @Access(AccessType.PROPERTY)
public abstract class PlatformTicker implements TickerKey {
  private final ObjectProperty<Platform> platformConnector =
    new SimpleObjectProperty<>();
...
  public PlatformTicker() {
  }
...
  @ManyToOne public Platform getPlatformConnector() {
    return platformConnector.get();
  }
  public void setPlatformConnector(Platform platformConnector) {
    this.platformConnector.set(platformConnector);
  }
...
}

I get an exception thrown  when trying to create an entity manager i.e.

67:  this.em = emf.createEntityManager();

Caused by: com.objectdb.o._PersistenceException: Failed to locate set method for field property domain.PlatformTicker.platformConnector using reflection
    at com.objectdb.o._PersistenceException.b(_PersistenceException.java:45)
    at com.objectdb.o.JPE.g(JPE.java:145)
    at com.objectdb.o.ERR.f(ERR.java:56)
    at com.objectdb.o.OST.onObjectDBError(OST.java:599)
    at com.objectdb.jpa.EMF.createEntityManager(EMF.java:153)
    at domain.DomainModel.<init>(DomainModel.java:67)

This is otherwise working code. The error is intermittent. The database explorer can open the database and browse the data. It seems odd that the error message should complain about field properties when I am using property based accessors throughout the application - and I have provided the property based accessor for the field being complained about.

Any ideas would be greatly appreciated.

Code works fine when running with ObjectDB embedded, but throws the exception randomly when application accesses ObjectDB in  server mode.

Paul Hudson
#2

> Code works fine when running with ObjectDB embedded, but throws the exception randomly when application accesses ObjectDB in  server mode.

This is strange.

Could you please provide more information, including:

  1. Are you using version 2.6.9? Can you try new versions of ObjectDB?
  2. Does it happen always only with that specific persistent property?
  3. What is special with that specific persistent property compared to other persistent properties?
  4. Are inheritance and property overriding involved?
  5. What is exactly Platform (the property type)?
  6. Can you try changing the PlatformTicker class to non abstract?

 

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#3

Thank you for your response and your suggestions - some of which I have looked into. I have eventually got to the root of the problem insofar as I have implemented many of my properties using observable javafx.beans.properties which can (I have found) result in problems if a bound property or listener fires and causes an error while ObjectDB is loading the data - clearly my fault not ObjectDB's. However the error message

Failed to locate set method for field property...

is misleading IMHO firstly because I am using exclusively property based accessors @Access(AccessType.PROPERTY), not field based and secondly as the problematic setter in my case was a different property than the one named by ObjectDB. I had to strip the code back until it started working and then add code back to determine that.

Happy to live and learn on this and thanks again for your help.

Paul Hudson
#4

Thank you for your feedback. We will check and try to improve the error message.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login