2 Replies Latest reply on Dec 30, 2005 8:53 PM by Emmanuel Bernard

    Inheritance Issues

    Alvaro Martinez Newbie

      Hello people

      I would like to know whether you can help me with the following issue, posted by my application at deployment stage:


      15:01:20,578 WARN [ServiceController] Problem creating service jboss.j2ee:service=EJB3,module=XCellDomain.par
      java.lang.NullPointerException
      at org.hibernate.util.StringHelper.root(StringHelper.java:150)
      at org.hibernate.mapping.PersistentClass.getProperty(PersistentClass.java:348)
      at org.hibernate.mapping.PersistentClass.getProperty(PersistentClass.java:357)
      at org.hibernate.cfg.annotations.TableBinder.bindFk(TableBinder.java:136)
      at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:519)
      at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:256)
      at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:191)
      at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:988)
      at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:607)
      at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:75)
      at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:473)
      at org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:202)
      at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:78)
      at org.jboss.ejb3.Ejb3Deployment.initializeManagedEntityManagerFactory(Ejb3Deployment.java:512)
      at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:253)
      at org.jboss.ejb3.Ejb3JmxDeployment.create(Ejb3JmxDeployment.java:230)
      at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:34)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:245)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:228)
      at sun.reflect.GeneratedMethodAccessor70.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      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:943)
      at $Proxy0.create(Unknown Source)
      at org.jboss.system.ServiceController.create(ServiceController.java:341)
      at org.jboss.system.ServiceController.create(ServiceController.java:284)
      at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      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:208)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      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 $Proxy11.create(Unknown Source)
      at org.jboss.deployment.MainDeployer.create(MainDeployer.java:935)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:789)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753)
      at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      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:319)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:507)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:192)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:203)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:182)
      15:01:20,609 INFO [EJB3Deployer] Deployed: file:/D:/Java/jboss-4.0.3/server/all/deploy/XCellDomain.par


      The cause of this issue is the following entity bean:

      @Entity
      @Table( name="cdmn_FacturasCompra", schema= "CellDom" )
      @Inheritance(discriminatorValue = "OFacturaCompra")
      @PrimaryKeyJoinColumns({
       @PrimaryKeyJoinColumn(name = "EmprId", referencedColumnName="EmprId" ),
       @PrimaryKeyJoinColumn(name = "FactNo", referencedColumnName="FactNo")
      })
      public class OFacturaCompra extends OFactura implements Serializable
      {
       private static final long serialVersionUID = 1L;
      ....
      


      which inherits from

      @Entity
      @Table( name="cdmn_facturas", schema= "CellDom" ) // The superclass table
      @Inheritance( strategy=InheritanceType.JOINED,
       discriminatorValue = "OFactura",
       discriminatorType=DiscriminatorType.STRING)
      @DiscriminatorColumn(name="ObjClass")
      public class OFactura extends CEJB3Validator implements Serializable
      {
       //------------------------------------------------------------------
       // Enumerations
       //------------------------------------------------------------------
       private static final long serialVersionUID = 1L;
      
       public enum MPago {Nulo, Inmediato, Plazo, Crédito}
       public enum MPlazos {Nulo, Dias, Meses, Años}
      
       protected OFacturaPK FactPK;
       protected Timestamp Fecha;
       protected double ValorTotal;
      
      


      This entity uses a composed primary key as shown in the following fragment of code.

      @Embeddable(access=AccessType.PROPERTY)
      @Table(name="cdmn_Facturas", schema= "CellDom")
      public class OFacturaPK extends CEJB3Validator implements Serializable
      {
      
       //------------------------------------------------------------------
       // Attributes
       //------------------------------------------------------------------
       private static final long serialVersionUID = 1L;
       protected OCorporacion empr;
       protected String factNo;
      
      ....
      
       @ManyToOne( targetEntity=com.aemm.celldomn.entity.OCorporacion.class,
       fetch=EAGER, cascade={CascadeType.REFRESH})
       @JoinColumn(name="EmprId", referencedColumnName="EmprId" )
       public OCorporacion getEmpr()
       {
       return empr;
       }
      
      


      I suspect the problem has to do with the annotations but I have not got to identify where it is exactly. I have read EJB3 and hibbernate handbooks but info in those manuals relating inheritance is not quite deep as to show me the way. I really need your help.

      Thanks in advance
      Alvaro E Martinez M
      alvarommz@yahoo.com