简体   繁体   English

数据核增强器错误:无对象类

[英]Datanucleus enhancer error: no objectid-class

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. 运行DataNucleus Enhancer会出现以下错误:类MyBean具有应用程序标识,并且未指定objectid-class却具有0个主键字段。 Unable to use SingleFieldIdentity. 无法使用SingleFieldIdentity。

Why? 为什么?

It seems that the problem is the @Transient annotation on the method. 看来问题出在方法上的@Transient批注。 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. 尽管如此,在这种情况下,考虑到字段上的@Access和@Id批注,应该忽略@Transient批注。 Or, preferably, the error message should be improved. 或者,优选地,错误消息应该被改善。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM