[jboss-jira] [JBoss JIRA] Created: (EJBTHREE-1188) Deployment of @ManyToMany fails.

Alexander Tsirel (JIRA) jira-events at lists.jboss.org
Mon Feb 4 08:26:03 EST 2008


Deployment of @ManyToMany fails.
--------------------------------

                 Key: EJBTHREE-1188
                 URL: http://jira.jboss.com/jira/browse/EJBTHREE-1188
             Project: EJB 3.0
          Issue Type: Bug
          Components: EJB3 Extensions
    Affects Versions: AS 4.2.1.GA
         Environment: JBoss Bootstrap Environment

JBOSS_HOME: C:\jboss-4.2.1.GA

JAVA: C:\Program Files\Java\jdk1.5.0_09\bin\java

JAVA_OPTS: -Dprogram.name=run.bat -server -Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000

CLASSPATH: C:\Program Files\Java\jdk1.5.0_09\lib\tools.jar;C:\jboss-4.2.1.GA\bin\run.jar 
            Reporter: Alexander Tsirel


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() {
        return id;
    }

    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() {
        return students;
    }


    public void setStudents(Collection<Student> students) {
        this.students = students;
    }
}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list