Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/400.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 带有gae的spring数据jpa出错_Java_Google App Engine_Jpa_Spring Data_Google Cloud Datastore - Fatal编程技术网

Java 带有gae的spring数据jpa出错

Java 带有gae的spring数据jpa出错,java,google-app-engine,jpa,spring-data,google-cloud-datastore,Java,Google App Engine,Jpa,Spring Data,Google Cloud Datastore,我使用谷歌应用程序引擎和Spring数据JPA @Entity public class Feed { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key id; private String name; private String url; private Date created; public Feed() { } public

我使用谷歌应用程序引擎和Spring数据JPA

@Entity
public class Feed {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Key id;

    private String name;
    private String url;
    private Date created;

    public Feed() {
    }

    public Feed(String name, String url) {
        this.name = name;
        this.url = url;
        this.created = new Date();
    }

    // Getter and Setter
}

@Entity
public class News {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Key id;

    @ManyToOne
    private Feed feed;
    private String title;
    private Text content;
    private String link;

    private Date created;

    public News(Feed feed, String title, String content, String link) {
        this.feed = feed;
        this.title = title;
        this.content = new Text(content);
        this.link = link;
        this.created = new Date();
    }
    //Getter and Setter
}
错误消息是

尝试将键为feed661466952700416的子项分配给父项 有关键的新闻还没有id。父键是不可变的;嵌套 异常为javax.persistence.PersistenceException:尝试分配 带钥匙的孩子向带钥匙的家长馈送6614661952700416 还没有身份证。父键是不可变的


如何解决这个问题

似乎您正在为新闻分配提要并试图将其持久化,但家长需要的内容尚未持久化。

谢谢您的回答。但我无法修复它。您能给我提供更多信息或编码plz吗?@takeone在分配任何提要之前保留新闻实体。