Reputation: 667
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn (name = "account_id")
private Account account;
Works fine.
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn
private Account account;
Results in: Exception : Missing column account in SomeSchema.SomeOwnerTable
JPA Spec says default join column name is
property name ( 'account') + '_' + target table primary key ( 'id' )
But it looks like hibernate is searching just the property named 'account' instead of 'account_id'.
Any comment?
Upvotes: 3
Views: 2088
Reputation: 597016
I think you can safely get rid of the @JoinColumn
annotation - there's a join column anyway.
Also, make sure you haven't configured a specific naming strategy, that may override the default behaviour.
Upvotes: 4