So when I run my project the User table and the Doc table are created, but I dont see the foreign key for User table in the Doc table.
As you can see I have both ManyToOne and OneToMany annotations, and yet the foreign key for User isn't created.
How can I solve this ?
解决方案
You need to add @JoinColumn(name = "ID Column Name") annotation along with the @ManyToOne or @OneToMany annotation as ZaoTaoBao mentioned. This annotation determines the name of the column which is to be used as FK.