hibernate - Can a @OneToOne relationship contain a @ForiegnKey annotation -
Does it make sense that @OneToOne member joins @forganjeanotation?
@ Entitie class user {@Id @ generatedValue (strategy = IDENTITY) int id; @OneToOne @ForeignKey @JoinColumn (name = "home_address_id", referenced column name = "id") address home page; } @ Entity Class Address {@Id @ generatedValue (strategy = IDENTITY) int id; } "
I do not think it is necessary because the mapping is viable to make a foreigner The key for the column
On the other hand, if you think that it will help you and other developers to understand the code easier and there is no problem with it, you can leave it there.
However, it seems that the foreking annotation is exclusively a hybrancet where the endowment annotation is part of the Java Atitissance API. It can support the idea of taking it
Comments
Post a Comment