Hibernate/persistence without @Id

后端 未结 9 835
梦谈多话
梦谈多话 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条回答
  •  -上瘾入骨i
    2020-11-28 10:03

    Modify your select used for view creation:

    SELECT
       ROWNUM ID, -- or use nextval of some sequence
       -- other columns
    FROM
      TABLE
    

    and map "ID" as primary key.

提交回复
热议问题