-
Bug
-
Resolution: Cannot Reproduce
-
Major
-
None
-
AS 4.2.1.GA
-
None
Two entities relates as many to many (Course and Student).
During deployment it throws:
Caused by: org.hibernate.MappingException: Could not determine type for: java.util.Collection, for columns: org.hibernate.mapping.Column(students)]
Both sides using Generics.
Here is the latest code:
@Entity(name = "StudentUni")
public class Student implements Serializable {
private int id;
private String name;
private Collection<Course> courses = new ArrayList<Course>();
public Student()
{ id = (int) System.nanoTime(); }@Id
public int getId() { return id; }
public void setId(int id) { this.id = id; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
@ManyToMany
public Collection<Course> getCourses() { return courses; }
public void setCourses(Collection<Course> courses) { this.courses = courses; }
}
@Entity(name = "CourseUni")
public class Course implements Serializable {
private int id;
private String courseName;
private Collection<Student> students = new ArrayList<Student>();
public Course(){ id = (int) System.nanoTime(); }
@Id
public int getId()
public void setId(int id)
{ this.id = id; }public String getCourseName()
{ return courseName; }public void setCourseName(String courseName)
{ this.courseName = courseName; } @ManyToMany(mappedBy = "courses")
public Collection<Student> getStudents()
public void setStudents(Collection<Student> students)
{ this.students = students; }}