使用hibernate的註解@ManyToOne時遇到錯誤:
Caused by: org.hibernate.MappingException: Could not determine type for:
com.xxx.entity.Site, at table: channel, for columns:
[org.hibernate.mapping.Column(site)]
解決方案:註解要麼寫在字段上,要麼寫在getXX上,千萬千萬不能混合使用,否則會報這個錯誤!
對於一個實體類來說,要麼所有的註解都寫在字段上,要麼都寫在getXX上,不要有的寫在字段上,有的寫在getXX上。