3 Replies Latest reply on Apr 15, 2005 5:45 AM by Emmanuel Bernard

    OneToOne problem

    Piero Sartini Newbie

      i'm using classes like this:

      @Entity
      @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
      public class Person extends DBObject {
      ...
      private Address address;
      ...
      @OneToOne(cascade = CascadeType.ALL, usePKasFK=true)
      @JoinColumn(name = "ADDRESS_ID")
      public Address getAddress() {
      return address;
      }
      }

      @Entity
      @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
      public class Address extends DBObject {
      ...
      }

      DBObject holds the id and some fields like lastChanged and created.

      without the usePKasFK=true there is a nullpointer exception, but with it the column ADDRESS_ID is not there.. it worked fine until preview 4. i'm using the jboss-head version from cvs now .. any suggestions?

        • 1. Re: OneToOne problem
          Emmanuel Bernard Master

          Hum... I have the same case in the test suite and it works.
          Can you provide the stack trace?

          • 2. Re: OneToOne problem
            Piero Sartini Newbie

             

            11:05:54,472 INFO [Ejb3Module] EJB3 deployment time took: 36
            11:05:54,487 INFO [Ejb3Module] Found hibernate.properties file in EJB3 jar
            11:05:54,488 INFO [AnnotationConfiguration] Mapping class using metadata: xxx.Address
            11:05:54,496 INFO [AnnotationConfiguration] Mapping class using metadata: xxx.ClearingData
            11:05:54,511 INFO [AnnotationConfiguration] Mapping class using metadata: xxx.LoginData
            11:05:54,519 INFO [AnnotationConfiguration] Mapping class using metadata: xxx.Person
            11:05:54,522 ERROR [Ejb3Module] Starting failed jboss.j2ee:service=EJB3,module=xxx.ejb3
            java.lang.NullPointerException
             at org.hibernate.cfg.AnnotationBinder.bindOneToOne(AnnotationBinder.java:1285)
             at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:757)
             at org.hibernate.cfg.AnnotationBinder.processElementsOfAClass(AnnotationBinder.java:573)
             at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:436)
             at org.hibernate.cfg.AnnotationConfiguration.addAnnotatedClass(AnnotationConfiguration.java:94)
             at org.hibernate.cfg.AnnotationConfiguration.addAnnotatedClasses(AnnotationConfiguration.java:62)
             at org.jboss.ejb3.entity.HibernateSessionFactory.createSessionFactory(HibernateSessionFactory.java:196)
             at org.jboss.ejb3.Ejb3Module.createHibernateSessionFactory(Ejb3Module.java:256)
             at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:263)
             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:142)
             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:246)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:653)
             at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:895)
             at $Proxy0.start(Unknown Source)
             at org.jboss.system.ServiceController.start(ServiceController.java:416)
             at sun.reflect.GeneratedMethodAccessor9.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:142)
             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:246)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:653)
             at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
             at $Proxy17.start(Unknown Source)
             at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:166)
             at org.jboss.deployment.MainDeployer.start(MainDeployer.java:964)
             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:775)
             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
             at sun.reflect.GeneratedMethodAccessor44.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:142)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
             at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:121)
             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:246)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:653)
             at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
             at $Proxy8.deploy(Unknown Source)
             at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:309)
             at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:467)
             at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:198)
             at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:209)
             at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:188)
            11:05:54,524 WARN [ServiceController] Problem starting service jboss.j2ee:service=EJB3,module=xxx.ejb3
            java.lang.NullPointerException
             at org.hibernate.cfg.AnnotationBinder.bindOneToOne(AnnotationBinder.java:1285)
             at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:757)
             at org.hibernate.cfg.AnnotationBinder.processElementsOfAClass(AnnotationBinder.java:573)
             at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:436)
             at org.hibernate.cfg.AnnotationConfiguration.addAnnotatedClass(AnnotationConfiguration.java:94)
             at org.hibernate.cfg.AnnotationConfiguration.addAnnotatedClasses(AnnotationConfiguration.java:62)
             at org.jboss.ejb3.entity.HibernateSessionFactory.createSessionFactory(HibernateSessionFactory.java:196)
             at org.jboss.ejb3.Ejb3Module.createHibernateSessionFactory(Ejb3Module.java:256)
             at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:263)
             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:142)
             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:246)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:653)
             at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:895)
             at $Proxy0.start(Unknown Source)
             at org.jboss.system.ServiceController.start(ServiceController.java:416)
             at sun.reflect.GeneratedMethodAccessor9.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:142)
             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:246)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:653)
             at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
             at $Proxy17.start(Unknown Source)
             at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:166)
             at org.jboss.deployment.MainDeployer.start(MainDeployer.java:964)
             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:775)
             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
             at sun.reflect.GeneratedMethodAccessor44.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:142)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
             at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:121)
             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:246)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:653)
             at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
             at $Proxy8.deploy(Unknown Source)
             at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:309)
             at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:467)
             at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:198)
             at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:209)
             at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:188)
            11:05:54,526 INFO [EJB3Deployer] Deployed: file:/home/ps/srv/jboss-5.0.0alpha/server/default/deploy/xxx.ejb3
            11:05:54,544 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
            MBeans waiting for other MBeans:
            ObjectName: jboss.j2ee:service=EJB3,module=xxx.ejb3
             state: FAILED
             I Depend On:
             Depends On Me: java.lang.NullPointerException
            ObjectName: jboss.j2ee:service=EJB3,name=xxx
             state: CREATED
             I Depend On:
             Depends On Me:
            
            MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM:
            ObjectName: jboss.j2ee:service=EJB3,name=xxx
             state: CREATED
             I Depend On:
             Depends On Me:
            ObjectName: jboss.j2ee:service=EJB3,module=letix.ejb3
             state: FAILED
             I Depend On:
             Depends On Me: java.lang.NullPointerException