无法在IntelliJ IDEA上使用JDO2对GAE / J项目进行持久化

时间:2013-07-28 23:31:35

标签: java google-app-engine intellij-idea google-cloud-datastore jdo

我尝试在IntelliJ IDEA上使用JDO2创建一个新的GAE / J项目,但由于以下org.datanucleus.jdo.exceptions.ClassNotPersistenceCapableException,它无法正常工作:

The class "Book" is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data/annotations for the class are not found." is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data for the class is not found.

我也尝试在Eclipse上创建完全相同的项目,它运行良好,没有任何问题。创建的模型非常简单如下(我认为这个模型是无关的):

@PersistenceCapable
public class Book {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;

    @Persistent
    private String name;

    public Book(String name) {
        this.name = name;
    }
}

感谢。

1 个答案:

答案 0 :(得分:0)

  

这意味着它要么没有增强,要么增强   该文件的版本不在CLASSPATH中(或被隐藏   未增强的版本),或类的元数据/注释   没有找到。“这是不可持续的。这意味着它要么没有   增强,或者文件的增强版本不在   CLASSPATH(或被未增强版本隐藏)或元数据   没找到班级。

消息很清楚恕我直言。您必须在运行时增强类并在CLASSPATH中使用增强版本。