小编Fak*_*ion的帖子

尝试保存数据时找不到实体..

I'm getting this exception when I try to save a topic with a message: nested exception is javax.persistence.EntityNotFoundException: Unable to find mypackage.model.Message with id fb8d39ea-0094-410d-975a-ea4495781422

Here is the model :

@Entity
public class Topic {
    @Id
    private String id;
    private String title;
    private String projectName;
    private String author;
    @OneToMany(mappedBy = "topicId")
    private Set<Message> messages;
    public Topic() {
        this.messages = new HashSet<>();
    }
}

@Entity
public class Message {
    @Id
    private String id;
    private String author;
    private String content;
    private String …
Run Code Online (Sandbox Code Playgroud)

hibernate jpa spring-boot

3
推荐指数
1
解决办法
3428
查看次数

标签 统计

hibernate ×1

jpa ×1

spring-boot ×1