Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 364408

Summary: Unable to create JPA project with orm.xml containing many-to-one with a join-column
Product: [WebTools] Dali JPA Tools Reporter: Karen Butzke <karenfbutzke>
Component: JPAAssignee: Karen Butzke <karenfbutzke>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P1 CC: neil.hauge
Version: 3.1Flags: neil.hauge: review+
Target Milestone: 3.1 RC3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
proposed patch against HEAD none

Description Karen Butzke CLA 2011-11-21 13:58:35 EST
Create a JPA project and create and orm.xml mapping file that contains the following entity and many-to-one mapping. Clean the project and you get an NPE logged and a JPA validation error 'This project has the JPA facet, but no JPA project could be created.  See the error log for more details.'


<entity class="model.foo">
    <attributes>
	<many-to-one name="bar">
            <join-column/>
	</many-to-one>
    </attributes>
</entity>


Nested exception 2: java.lang.NullPointerException
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmNamedColumn.buildDefaultName(AbstractOrmNamedColumn.java:165)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmNamedColumn.update(AbstractOrmNamedColumn.java:85)
	at org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmBaseColumn.update(AbstractOrmBaseColumn.java:70)
Comment 1 Karen Butzke CLA 2011-11-21 14:14:51 EST
Created attachment 207330 [details]
proposed patch against HEAD
Comment 2 Karen Butzke CLA 2011-11-21 14:15:35 EST
checked in to HEAD for 3.1RC3
Comment 3 Neil Hauge CLA 2011-11-22 20:27:55 EST
For completeness:

This fix was required to fix a stop-ship regression in our XML mapping file support.  The fix is small, isolated, and low risk.  The fix was modeled after other similar code changes that were missed in this case.  The fix was reviewed and tested by me.
Comment 4 Neil Hauge CLA 2012-01-12 14:10:07 EST
See comment #2.