dataNucleus 5.1.1:dnSetid NoSuchMethodError
@MappedSuperclass
public class Foo {
@Transient
public Long getId() {
...
}
public void setId(Long id) {
...
}
}
@Entity
public class Bar extends Foo {
@Id
@GeneratedValue(strategy=GenerationType.TABLE, generator="gen")
@TableGenerator(name="gen", ...)
public Long getId() {
...
}
}
java.lang.NoSuchMethodError:com.example.Bar类中没有虚方法dnSetid(Long)
at com.example.Bar.dnCopyKeyFieldsFromObjectId(Unknown Source:15)
at com.example.Bar.dnNewInstance(Unknown Source:10)
at org.datanucleus.enhancer.EnhancementHelper.newInstance(EnhancementHelper.java:178)
at org.datanucleus.state.StateManagerImpl.initialiseForHollow(StateManagerImpl.java:373)
at org.datanucleus.state.ObjectProviderFactoryImpl.newForHollow(ObjectProviderFactoryImpl.java:113)
at org.datanucleus.ExecutionContextImpl.findObject(ExecutionContextImpl.java:3194)
at org.datanucleus.store.rdbms.query.PersistentClassROF.findObjectWithIdAndLoadFields(PersistentClassROF.java:458)
at org.datanucleus.store.rdbms.query.PersistentClassROF.getObject(PersistentClassROF.java:364)
at org.datanucleus.store.rdbms.query.ForwardQueryResult.nextResultSetElement(ForwardQueryResult.java:180)
at org.datanucleus.store.rdbms.query.ForwardQueryResult$QueryResultIterator.next(ForwardQueryResult.java:408)
at org.datanucleus.store.rdbms.query.ForwardQueryResult.processNumberOfResults(ForwardQueryResult.java:136)
at org.datanucleus.store.rdbms.query.ForwardQueryResult.advanceToEndOfResultSet(ForwardQueryResult.java:164)
at org.datanucleus.store.rdbms.query.ForwardQueryResult.closingConnection(ForwardQueryResult.java:290)
at org.datanucleus.store.query.AbstractQueryResult.disconnect(AbstractQueryResult.java:105)
at org.datanucleus.store.rdbms.query.AbstractRDBMSQueryResult.disconnect(AbstractRDBMSQueryResult.java:251)
at org.datanucleus.store.rdbms.query.JPQLQuery$2.managedConnectionPreClose(JPQLQuery.java:654)
at org.datanucleus.store.rdbms.ConnectionFactoryImpl$ManagedConnectionImpl.close(ConnectionFactoryImpl.java:532)
at org.datanucleus.store.connection.AbstractManagedConnection.release(AbstractManagedConnection.java:83)
at org.datanucleus.store.rdbms.ConnectionFactoryImpl$ManagedConnectionImpl.release(ConnectionFactoryImpl.java:371)
at org.datanucleus.store.rdbms.query.JPQLQuery.performExecute(JPQLQuery.java:730)
at org.datanucleus.store.query.Query.executeQuery(Query.java:1966)
at org.datanucleus.store.query.Query.executeWithMap(Query.java:1873)
应通过增强添加dnSetid。反编译的Bar.class:没有这样的方法。它包含dnGetid()和其他方法dn ****。
答案 0 :(得分:2)
覆盖的唯一方法是覆盖BOTH getter AND setter。 可能增强器依赖于存在,无论是对于已定义的属性还是被覆盖的属性。