Hibernate/persistence without @Id

后端 未结 9 837
梦谈多话
梦谈多话 2020-11-28 09:07

I have a database view that yields a result set that has no true primary key. I want to use Hibernate/Persistence to map this result set onto Java objects. Of course, becaus

9条回答
  •  感情败类
    2020-11-28 09:45

    you could just use @EmbeddedId as follows:

    @EmbeddedId
    public Id getId() {
        return id;
    }
    
    public void setId(Id id) {
        this.id = id;
    }
    

提交回复
热议问题