JPA Composite Key + Sequence

后端 未结 4 382
春和景丽
春和景丽 2021-02-02 14:51

Is it possible in plain JPA or JPA+Hibernate extensions to declare a composite key, where an element of the composite key is a sequence?

This is my composite class:

4条回答
  •  时光取名叫无心
    2021-02-02 15:11

    I notice that it appears your building a composite primary key like this example. While I was poking at a similar problem in my own database I wondered if maybe you could call the sql directly like:

    select nextval ('hibernate_sequence')

    I suppose that would be cheating though ;-)

提交回复
热议问题