KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
What's the exact difference between @JoinColumn and @PrimaryKeyJoinColumn ? You use @JoinColumn for columns that are part of a foreign key. A typical column could look like (e.g. in a join table with additional attributes): @ManyToOne @JoinColumn(name = "...") private OtherClass oc; What happens if I promote the column to be a/the PK, too (a.k.a. identifying relationship)? As the column is now the PK, I must tag it with @Id : @Id @ManyToOne @JoinColumn(name = "...") private OtherClass oc; Now the question is: Are @Id + @JoinColumn the same as just @PrimaryKeyJoinColumn ?: @ManyToOne @PrimaryKeyJoinColumn(name = "...") private OtherClass oc; If not, what's @PrimaryKeyJoinColumn there for?
Tags (comma-separated)
Save Edits
Cancel