Java 带有gae的spring数据jpa出错
我使用谷歌应用程序引擎和Spring数据JPAJava 带有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
@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在分配任何提要之前保留新闻实体。