3
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn (name = "account_id")
private Account account;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn
private Account account;
結果:Exception : Missing column account in SomeSchema.SomeOwnerTable
JPA規範說默認的聯接的列名是
property name ('account') + '_' + target table primary key ('id')
但它看起來像Hibernate是搜索剛剛任命的,而不是 'ACCOUNT_ID' 賬戶'的屬性。
有何評論?
我正在使用ImprovedNamingStrategy。 ImprovedNamingStrategy轉換,例如Account - > account,accountId - > account_id。 – drypot 2010-09-29 05:57:36
ImprovedNamingStrategy是問題所在。謝謝。 http://matthew.mceachen.us/blog/hibernate-naming-strategies-20.html – drypot 2010-09-29 06:00:24
+1不錯的一個(pad) – 2010-09-29 06:03:56