4 Replies Latest reply on Feb 24, 2006 9:34 AM by yantriki

    What's wrong with the following OR mapping?

       

      @Entity
      @Table(name="ModuleType")
      public class ModuleType implements Serializable {
      
       Collection<Module> modules_of_type = new HashSet<Module>();
       @Id @GeneratedValue int id;
      
       @OneToMany(cascade=CascadeType.REMOVE,mappedBy="type")
       public Collection<Module> getModules() {
       return modules_of_type;
       }
      
       public void setModules(Collection<Module> modules) {
       this.modules_of_type = modules;
       }
      
       @Column(name="TYPE_ID")
       public int getId() {
       return id;
       }
       public void setId(int id) {
       this.id = id;
       }
      }
      
      

      @Entity
      @Table(name="Module")
      public class Module implements Serializable{
       int moduleID;
       @Id
       @GeneratedValue
       public int getModuleID() {
       return moduleID;
       }
       public void setModuleID(int moduleID) {
       this.moduleID = moduleID;
       }
       @ManyToOne
       @JoinColumn(name="TYPE_ID",nullable=false)
       public ModuleType getType() {
       return type;
       }
      
       public void setType(ModuleType type) {
       this.type = type;
       }
      }


      I am getting the following errors:

      Caused by: org.hibernate.MappingException: Could not determine type for: java.util.Collection, for columns: [org.hibernate.mapping.Column(modules_of_type)]