1 Reply Latest reply on Feb 14, 2005 2:14 PM by Bill Burke

    Problem when extending an Entity EJB class

    Denis Souza Newbie

      Consider this simple example:

      @Entity
      @Table(name = "PERSON")
      public class Person extends Object implements Serializable {
      
       protected Integer id;
       protected String name;
      
       @Id(generate = GeneratorType.AUTO)
       public Integer getId() {
       return id;
       }
      
       public void setId(Integer id) {
       this.id = id;
       }
      
       @Column(name = "NAME", nullable = false, length = 100)
       public String getName() {
       return name;
       }
      
       public void setName(String name) {
       this.name = name;
       }
      }
      


      Works fine, but if I extend the class from another very simple class:

      @Entity
      @Table(name = "PERSON")
      public class Person extends EntityBeanAbstract {
      ...
      }
      
      public abstract class EntityBeanAbstract {
      
       public boolean equals(Object object) {
       ...
       }
      }
      
      


      I get this:

      16:44:02,438 ERROR [Ejb3Module] Starting failed jboss.j2ee:service=EJB3,module=entities.ejb3
      java.lang.NullPointerException
      at org.jboss.ejb3.entity.EntityToHibernateXml.getDeclaredEntityProperties(EntityToHibernateXml.java:400)
      at org.jboss.ejb3.entity.EntityToHibernateXml.getAnnotatedProperty(EntityToHibernateXml.java:316)
      at org.jboss.ejb3.entity.EntityToHibernateXml.getAnnotatedProperty(EntityToHibernateXml.java:327)
      at org.jboss.ejb3.entity.EntityToHibernateXml.handleBasicClass(EntityToHibernateXml.java:1839)
      at org.jboss.ejb3.entity.EntityToHibernateXml.handleClass(EntityToHibernateXml.java:1457)
      at org.jboss.ejb3.entity.EntityToHibernateXml.convert(EntityToHibernateXml.java:161)
      at org.jboss.ejb3.entity.HibernateSessionFactory.createSessionFactory(HibernateSessionFactory.java:144)
      at org.jboss.ejb3.Ejb3Module.createHibernateSessionFactory(Ejb3Module.java:213)
      at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:225)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:272)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:222)
      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:144)
      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:249)
      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.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:144)
      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:249)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy16.start(Unknown Source)
      at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:166)

      If I remove all methods from the parent class, it still keeps happening.
      Any ideas? Could this be a bug? It happens with EJB3 Preview 3. Works on Preview 2.

      D