2 Replies Latest reply on Sep 14, 2005 6:17 AM by Patrik Meisinger

    Could not determine type for: java.util.Collection

    Patrik Meisinger Newbie

      hi!

      i want to use @OneToMany annotations but i get the following error after deploying my .ear file:
      "Could not determine type for: java.util.Collection, for columns: [org.hibernate.mapping.Column(omOkopf)]"

      my relations look like this:
      PvStamp(1)<->(*)OmOcros(*)<->(1)OmOkopf(1)<->(*)OmOpos

      the sql joins for the relations are:
      PvStamp.ident = OmOcros.cross_1
      OmOkopf.objekt = OmOcros.objekt
      OmOkopf.objekt = OmOpos.objekt

      PvStamp.java looks like this:

      @Entity
      @Table (name="PV_STAMP")
      public class PvStamp implements Serializable {
       // ... some properties
       private Collection<OmOcros> omOcros = new HashSet();
       @Id
       @Column (name = "IDENT")
       public Integer getIdent() {
       return ident;
       }
       public void setIdent(Integer ident) {
       this.ident = ident;
       }
      
       @OneToMany (targetEntity=ams.ingres.model.OmOcros.class, cascade=CascadeType.ALL,
       mappedBy="pvStamp")
       public Collection<OmOcros> getOmOcros() {
       return omOcros;
       }
       public void setOmOcros(Collection<OmOcros> omOcros) {
       this.omOcros = omOcros;
       }
      
      }
      

      OmOcross.java
      @Entity
      @Table (name="OM_OKOPF")
      
      public class OmOcros {
       // some properties
       private Collection<OmOkopf> omOkopf = new HashSet();
       private Collection<PvStamp> pvStamp = new HashSet();
      
       @Id
       @Column (name="OBJEKT")
       public int getObjekt() {
       return objekt;
       }
       public void setObjekt(int objekt) {
       this.objekt = objekt;
       }
      // ... some setters/getters
       public Collection<OmOkopf> getOmOkopf() {
       return omOkopf;
       }
       public void setOmOkopf(Collection<OmOkopf> omOkopf) {
       this.omOkopf = omOkopf;
       }
      
       public Collection<PvStamp> getPvStamp() {
       return pvStamp;
       }
       public void setPvStamp(Collection<PvStamp> pvStamp) {
       this.pvStamp = pvStamp;
       }
      }
      

      OmOkopf.java
      @Entity
      @Table (name="OM_OKOPF")
      
      public class OmOkopf {
      // ... some properties
       private Collection<OmOpos> omOpos = new HashSet();
       private Collection<OmOcros> omOcros = new HashSet();
      
       @Id
       @Column (name="OBJEKT")
       public int getObjekt() {
       return objekt;
       }
       public void setObjekt(int objekt) {
       this.objekt = objekt;
       }
      
      // ... some setters/getters
      
       @OneToMany(targetEntity=ams.ingres.model.OmOpos.class, cascade=CascadeType.ALL,
       mappedBy="omOkopf")
       @JoinColumn(name="objekt")
       public Collection<OmOpos> getOmOpos() {
       return omOpos;
       }
      
       public void setOmOpos(Collection<OmOpos> omOpos) {
       this.omOpos = omOpos;
       }
      
       @OneToMany(targetEntity=ams.ingres.model.OmOcros.class, cascade=CascadeType.ALL,
       mappedBy="omOkopf")
       @JoinColumn(name="objekt")
       public Collection<OmOcros> getOmOcros() {
       return omOcros;
       }
      
       public void setOmOcros(Collection<OmOcros> omOcros) {
       this.omOcros = omOcros;
       }
      }
      

      OmOpos.java
      @Entity
      @Table (name="OM_OKOPF")
      public class OmOpos {
      // ... some properties
       private Collection<OmOkopf> omOkopf = new HashSet();
      
       @Id
       @Column (name="IDENT")
       public int getIdent() {
       return ident;
       }
       public void setIdent(int ident) {
       this.ident = ident;
       }
      // ... some setters/getters
       public Collection<OmOkopf> getOmOkopf() {
       return omOkopf;
       }
       public void setOmOkopf(Collection<OmOkopf> omOkopf) {
       this.omOkopf = omOkopf;
       }
      }
      


      full exception of the stack-trace:
      10:11:06,829 WARN [ServiceController] Problem creating service jboss.j2ee:service=EJB3,module=entities.par
      org.hibernate.MappingException: Could not determine type for: java.util.Collection, for columns: [org.hibernate.mapping.Column(omOkopf)]
       at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:265)
       at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:252)
       at org.hibernate.mapping.Property.isValid(Property.java:175)
       at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:330)
       at org.hibernate.mapping.RootClass.validate(RootClass.java:191)
       at org.hibernate.cfg.Configuration.validate(Configuration.java:815)
       at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:976)
       at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:178)
       at org.jboss.ejb3.entity.EntityManagerFactoryLoader.loadFactory(EntityManagerFactoryLoader.java:44)
       at org.jboss.ejb3.entity.EntityManagerFactoryLoader.loadFactory(EntityManagerFactoryLoader.java:31)
       at org.jboss.ejb3.Ejb3Module.initializeManagedEntityManagerFactory(Ejb3Module.java:290)
       at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:141)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:233)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:215)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:950)
       at $Proxy0.create(Unknown Source)
       at org.jboss.system.ServiceController.create(ServiceController.java:342)
       at org.jboss.system.ServiceController.create(ServiceController.java:281)
       at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy10.create(Unknown Source)
       at org.jboss.ejb3.EJB3Deployer.create(EJB3Deployer.java:157)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
       at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy11.create(Unknown Source)
       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:919)
       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:909)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:773)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:737)
       at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy6.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:325)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:501)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:204)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:215)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:194)
      


      i'm using eclipse3.1, hibernate 3.1, jboss4.0.3RC1 with ejb3.0, jdk1.5, jbosside1.5M2, hibernatetools 3.1alpha5.

      what's the reason why the deployment fails?

      any help is appreciated.

      thanks in advance.
      best regards
      patrik

      ps.: i searched in the forums and didn't find anything that helps me further...