Вопрос

I have the below domain model class

@Entity @Access(AccessType.FIELD)
public class MyBean {

     @Id @GeneratedValue
     private Long id;

     ...

     @Transient
     public String getOther() {
          ...
     }
}

Running DataNucleus Enhancer gives the following error: Class MyBean has application-identity and no objectid-class specified yet has 0 primary key fields. Unable to use SingleFieldIdentity.

Why?

Это было полезно?

Решение

It seems that the problem is the @Transient annotation on the method. Removing it solved the issue.

Still, in this case, taking into account the @Access and @Id annotation on a field, the @Transient annotation should be ignored. Or, preferably, the error message should be improved.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top