JPA: is @PrimaryKeyJoinColumn(…) the same as @JoinColumn(…, insertable = ?, updatable = ?)?

后端 未结 1 1498
梦毁少年i
梦毁少年i 2021-02-08 08:40

Can you derive from the JPA spec, if @PrimaryKeyJoinColumn(...), which doesn\'t have the insertable and updatable parameters, is the same as

@JoinC         


        
相关标签:
1条回答
  • 2021-02-08 09:27

    Yes, the two are equivalent.

    Note in JPA 2.0 you can also add an @Id to a @OneToOne mapping and avoid having the duplicate basic id attribute altogether.

    See

    • Identity and Sequencing > Primary Keys through OneToOne and ManyToOne Relationships and
    • OneToOne > Target Foreign Keys, Primary Key Join Columns, Cascade Primary Keys

    from the WikiBooks Java Persistence pages

    0 讨论(0)
提交回复
热议问题