Hibernate 多对1的 实现

Hibernate 多对一的 实现在一对多的问题中遇到Exception 如下:开始测试的时候,没有注意类型要一致,用了Lis

Hibernate 多对一的 实现
在一对多的问题中遇到Exception 如下:


开始测试的时候,没有注意类型要一致,用了List类型,结果就出现了
org.hibernate.exception.SQLGrammarException: could not initialize a collection

在Department中 尽量不用List作为集合的类型,原因如下:
lists are indexed collections and therefor need a index column