NullPointerException at runtime enhancement when the entity has no package
--------------------------------------------------------------------------

                 Key: OPENJPA-1003
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1003
             Project: OpenJPA
          Issue Type: Bug
    Affects Versions: 1.2.0
         Environment: DB2, openJPA 1.2.0-r422266:683325
            Reporter: Julien Kronegg
            Priority: Minor


The given entity (referenced as <class>C</class> in the persistence.xml) 
produce a NullPointerException at runtime enhancement:

    // no package
    @Entity
    @Table(...) // valid table definition
    public class C {
      private int id;
      @Id
      @Column(...) // valid column definition
      public int getId() {
        return this.id;
      }
      public void setId(int id) {
        this.id=id;
      }
    }

The NPE is :

    
org.apache.openjpa.enhance.ManagedClassSubclasser.setDetachedState(ManagedClassSubclasser.java:299)
    
org.apache.openjpa.enhance.ManagedClassSubclasser.configureMetaData(ManagedClassSubclasser.java:217)
    
org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(ManagedClassSubclasser.java:139)
    
org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:310)
    
org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:228)
    
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:190)

The class is enhanced like a charm when adding a package name.

I would expect  either:
1) allow the enhancement of entities without package name [preferred]
2) receive an error message such as "could not enhance an entity without 
package name".

I set the priority to "Minor" as this is not very likely that an entity is 
added without package.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to