hibernate一对多映射时异常Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @Collection
2016-10-09 11:26
465 查看
异常信息: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateTemplate' defined in class path resource [spring/applicationContext-db.xml]: Cannot resolve reference to bean 'sessionFactory'
while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [spring/applicationContext-db.xml]: Invocation of init
method failed; nested exception is org.hibernate.AnnotationException:Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements: com.PLCmonitor.domain.CraneQueryTimes.users
解决方法:private ArrayList<User> user=new ArrayList<User>();换成private List<User> exams=new ArrayList<User>();
while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [spring/applicationContext-db.xml]: Invocation of init
method failed; nested exception is org.hibernate.AnnotationException:Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements: com.PLCmonitor.domain.CraneQueryTimes.users
解决方法:private ArrayList<User> user=new ArrayList<User>();换成private List<User> exams=new ArrayList<User>();
相关文章推荐
- 解决org.hibernate.QueryException illegal attempt to dereference collection 异常错误
- hibernate注解版关联映射Many-to-One/Many-to-Many等&异常处理
- 解决org.hibernate.QueryException illegal attempt to dereference collection 异常错误
- Hibernate 异常: Illegal attempt to associate a collection with two open sessions
- 解决org.hibernate.QueryException illegal attempt to dereference collection 异常错误
- 解决org.hibernate.QueryException illegal attempt to dereference collection 错误异常
- Hibernate 异常:“@OneToOne or @ManyToOne on XXX references an unknown entity: XXX”
- 异常描述:hibernate懒加载中,用OpenSessionInViewFilter解决之后,同时对一个collection创建两个session访问导致异常(Illegal attempt to associate a collection with two open sessions)
- Hibernate 异常: Illegal attempt to associate a collection with two open sessions
- Use of @OneToMany or @ManyToMany targeting an unmapped class:hibernate映射错误
- org.hibernate.AnnotationException: Collection has neither generic type or OneToMany.targetEntity() defined: com.bjsxt.model.Student.courses
- Hibernate 异常:Illegal attempt to associate a collection with two open sessions
- 解决org.hibernate.QueryException illegal attempt to dereference collection 异常错误
- 码农小汪-Hibernate学习4-关联关系映射many-to-one,many-to-one,one-to-many
- hibernate映射文件many-to-one 元素属性
- Error/Exception-01-hibernate(jar包冲突)--javax.persistence.OneToMany.orphanRemoval()Z异常
- Hibernate 、多表关联映射-多对一关系(many-to-one)
- Hibernate 3.x "org.hibernate.LazyInitializationException: illegal access to loading collection"异常解决方法
- Hibernate学习笔记(3)Hibernate映射文件之set key one-to-many
- Hibernate 、多表关联映射-多对一关系(many-to-one)