I used Hibernate Tools to generate my Hibernate POJO mapping.
Unfortunately the code generated by Hibernate tools seems not to work, I get the exception
org.hibernate.AnnotationException: Collection has neither generic type or OneToMany.targetEntity()
The code parts that generate the exception are
/**
* ClassFlag generated by hbm2java
*/
@Entity
@Table(name = "class_flag", catalog = "incbszdb")
public class ClassFlag implements java.io.Serializable {
....
/* HERE */
private Set classFlagI18ns = new HashSet(0);
/* HERE */
public void setClassFlagI18ns(Set classFlagI18ns) {
this.classFlagI18ns = classFlagI18ns;
}
}
According to this post
and this post
You have to change Hibernates generated code by yourself by hand.
This is one thing I want to avoid. Any ideas what could be the problem?
Regards
JS
I have found a solution for me that works.
Simply check "Use Java 5 Syntax" as depicted in the attached Screenshot and Hibernate Tools generate the correct generic types for collections.