Using OpenJPA 1.2.1, presently with neither load-time or build-time
enhancement, for different reasons.  I have a ticket open for my
build-time enhancement issues.  It could be that since OpenJPA doesn't
support running without enhancement, I won't be able to make any
significant progress on this until my issues with build-time enhancement
are resolved.

I have mapped two simple classes, and I'm now trying to test the
mappings.  Each class has one relationship attribute.  The first one
relates to the second one, and the second one has a recursive
relationship.  Each one of these relationships is done with a join
table.  I believe I've specified the correct annotations and orm.xml
settings to do this mapping.  I tried running the generated SQL I saw
for the relationship, and it appears to give me a reasonable result.

I think the first relationship is working fine, but the second one is
giving me trouble.  When I run a request where the second relationship
ends up being empty, it works fine.  If it's not empty, I see the
following unhelpful message:

  WARNING: WebApplicationException has been caught : cause is
java.lang.NullPointerException

There is no stack trace.  So, I set Eclipse to stop on NPE and I found
it stopping at the following place:

        
com$att$ecom$dynamiccontent$domain$Category$pcsubclass.pcReplaceField(in
t) line: not available  
        StateManagerImpl.replaceField(PersistenceCapable, FieldManager,
int) line: 3025 
        StateManagerImpl.storeObjectField(int, Object) line: 2457       
        StateManagerImpl.storeObject(int, Object) line: 2447    
        
RelationCollectionTableFieldStrategy(StoreCollectionFieldStrategy).load(
OpenJPAStateManager, JDBCStore, JDBCFetchConfiguration) line: 569       
        FieldMapping.load(OpenJPAStateManager, JDBCStore,
JDBCFetchConfiguration) line: 819       
        JDBCStoreManager.load(OpenJPAStateManager, BitSet,
FetchConfiguration, int, Object) line: 688      
        
ROPStoreManager(DelegatingStoreManager).load(OpenJPAStateManager,
BitSet, FetchConfiguration, int, Object) line: 116      
        ROPStoreManager.load(OpenJPAStateManager, BitSet,
FetchConfiguration, int, Object) line: 78       
        StateManagerImpl.loadFields(BitSet, FetchConfiguration, int,
Object) line: 2921      
        StateManagerImpl.loadField(int, int, boolean, boolean) line:
2999    
        StateManagerImpl.fetchObjectField(int) line: 2242       
        StateManagerImpl.fetchField(int, boolean) line: 778     
        StateManagerImpl.fetch(int) line: 740   
        RedefinitionHelper$1.invoke(Object, Method, Object[]) line: 230 
        $Proxy130.iterator() line: not available        
      [deleted]

The fields of the class in question are:

    @Id
    private String  id;
    @Basic
    private String  displayName;
    @Temporal(TemporalType.DATE)
    private Date    creationDate;
    @OneToMany(fetch = FetchType.EAGER)
    private Set<Category>   childCategories;

The relevant portion of the orm.xml file is this:

   <entity name="Category" class="...domain.Category">
        <table name="CATEGORY"/>
        <attributes>
            <id name="id">
                <column name="CATEGORY_ID"/>
            </id>
            <one-to-many name="childCategories"
target-entity="Category">
                <join-table name="CAT_CHLDCAT">
                    <join-column name="CATEGORY_ID"
referenced-column-name="CATEGORY_ID"/>
                    <inverse-join-column name="CHILD_CAT_ID"
referenced-column-name="CATEGORY_ID"/>
                </join-table>
            </one-to-many>
        </attributes>
    </entity>

Reply via email to