1 Reply Latest reply on Oct 26, 2004 1:54 PM by janprill

    Multiple Inheritance (Grandmother -> Mother -> Daughter)

    janprill Novice

      Hi, EJB3-Team,

      I wonder if multiple inheritance is possible with the EJB3-Preview. As far as I've seen the examples of the different inheritance strategies in the tutorial only map single inheritance. What about longer inheritance graphs?

      I've tried a bit myself:

      @Entity
      @Inheritance(strategy = InheritanceType.JOINED, discriminatorType = DiscriminatorType.STRING)
      @DiscriminatorColumn(name = "TYPE", nullable = true)
      Grandmother.java


      @Entity
      @Inheritance(strategy = InheritanceType.JOINED, discriminatorType = DiscriminatorType.STRING, discriminatorValue = "Mother")
      Mother.java


      @Entity
      @Inheritance(strategy = InheritanceType.JOINED, discriminatorType = DiscriminatorType.STRING, discriminatorValue = "Daughter")
      Mother.java


      But got the following stacktrace on deployment, where ILDSEntity is a granny, MarkupText is a mom, Premise and Question are daughters. How do I need to annotate in such situations?

      12:11:34,531 INFO [Ejb3Module] found EJB3 Entity bean: com.inviado.model.entity.ILDSEntity
      12:11:34,531 INFO [Ejb3Module] found EJB3 Entity bean: com.inviado.model.entity.MarkupText
      12:11:34,531 INFO [Ejb3Module] found EJB3 Entity bean: com.inviado.model.entity.Premise
      12:11:34,531 INFO [Ejb3Module] found EJB3 Entity bean: com.inviado.model.entity.Question
      12:11:34,531 INFO [Ejb3Module] found EJB3 stateless session bean: com.inviado.model.stateless.EntityCreatorBean
      12:11:34,562 INFO [Ejb3Module] EJB3 jar using default hibernate.properties: {hibernate.transaction.manager_lookup_class=org.hibernate.transaction.JBossTransactionManagerLookup, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.dialect=org.hibernate.dialect.MySQLDialect, hibernate.hbm2ddl.auto=create-drop, hibernate.connection.datasource=java:/DefaultDS}
      12:11:34,718 ERROR [Ejb3Module] Starting failed jboss.j2ee:service=EJB3,module=iLDS.ejb3
      org.hibernate.MappingException: org.hibernate.MappingException: invalid mapping
       at org.hibernate.cfg.Configuration.addXML(Configuration.java:301)
       at org.jboss.ejb3.HibernateSessionFactory.createSessionFactory(HibernateSessionFactory.java:131)
       at org.jboss.ejb3.Ejb3Module.createHibernateSessionFactory(Ejb3Module.java:206)
       at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:218)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:271)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:221)
       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:242)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:891)
       at $Proxy0.start(Unknown Source)
       at org.jboss.system.ServiceController.start(ServiceController.java:416)
       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:242)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy16.start(Unknown Source)
       at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:168)
       at org.jboss.deployment.MainDeployer.start(MainDeployer.java:935)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:746)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:709)
       at sun.reflect.GeneratedMethodAccessor38.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:119)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:131)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:242)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy8.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:305)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:463)
       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)
      Caused by: org.hibernate.MappingException: invalid mapping
       at org.hibernate.cfg.Configuration.addXML(Configuration.java:296)
       ... 49 more
      Caused by: org.xml.sax.SAXParseException: The content of element type "join" must match "(subselect?,key,(property|many-to-one|component|dynamic-component|any)*,sql-insert?,sql-update?,sql-delete?)".
       at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
       at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
       at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
       at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
       at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
       at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
       at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
       at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
       at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
       at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
       at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
       at org.dom4j.io.SAXReader.read(SAXReader.java:339)
       at org.dom4j.io.SAXReader.read(SAXReader.java:271)
       at org.hibernate.cfg.Configuration.addXML(Configuration.java:295)
       ... 49 more
      12:11:34,718 WARN [ServiceController] Problem starting service jboss.j2ee:service=EJB3,module=iLDS.ejb3
      org.hibernate.MappingException: org.hibernate.MappingException: invalid mapping
       at org.hibernate.cfg.Configuration.addXML(Configuration.java:301)
       at org.jboss.ejb3.HibernateSessionFactory.createSessionFactory(HibernateSessionFactory.java:131)
       at org.jboss.ejb3.Ejb3Module.createHibernateSessionFactory(Ejb3Module.java:206)
       at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:218)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:271)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:221)
       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:242)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:891)
       at $Proxy0.start(Unknown Source)
       at org.jboss.system.ServiceController.start(ServiceController.java:416)
       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:242)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy16.start(Unknown Source)
       at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:168)
       at org.jboss.deployment.MainDeployer.start(MainDeployer.java:935)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:746)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:709)
       at sun.reflect.GeneratedMethodAccessor38.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:119)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:131)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:242)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy8.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:305)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:463)
       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)
      Caused by: org.hibernate.MappingException: invalid mapping
       at org.hibernate.cfg.Configuration.addXML(Configuration.java:296)
       ... 49 more
      Caused by: org.xml.sax.SAXParseException: The content of element type "join" must match "(subselect?,key,(property|many-to-one|component|dynamic-component|any)*,sql-insert?,sql-update?,sql-delete?)".
       at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
       at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
       at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
       at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
       at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
       at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
       at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
       at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
       at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
       at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
       at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
       at org.dom4j.io.SAXReader.read(SAXReader.java:339)
       at org.dom4j.io.SAXReader.read(SAXReader.java:271)
       at org.hibernate.cfg.Configuration.addXML(Configuration.java:295)
       ... 49 more
      12:11:34,718 INFO [EJB3Deployer] Deployed: file:/D:/jboss-4.0.0/server/all/deploy/iLDS.ejb3
      12:11:34,750 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
      MBeans waiting for other MBeans:
      ObjectName: jboss.j2ee:service=EJB3,module=iLDS.ejb3
       state: FAILED
       I Depend On:
       Depends On Me: org.hibernate.MappingException: org.hibernate.MappingException: invalid mapping
      ObjectName: jboss.j2ee:service=EJB3,name=com.inviado.model.stateless.EntityCreatorBean
       state: CREATED
       I Depend On:
       Depends On Me:
      
      MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM:
      ObjectName: jboss.j2ee:service=EJB3,name=com.inviado.model.stateless.EntityCreatorBean
       state: CREATED
       I Depend On:
       Depends On Me:
      ObjectName: jboss.j2ee:service=EJB3,module=iLDS.ejb3
       state: FAILED
       I Depend On:
       Depends On Me: org.hibernate.MappingException: org.hibernate.MappingException: invalid mapping


      Best regards
      Jan Prill