Domanda

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?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top