Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 348143 - NullPointerException: Add entity to XML
Summary: NullPointerException: Add entity to XML
Status: VERIFIED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: General (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.0.1   Edit
Assignee: Karen Butzke CLA
QA Contact:
URL:
Whiteboard: fix_ready
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-02 17:15 EDT by Nan Li CLA
Modified: 2011-08-03 13:13 EDT (History)
2 users (show)

See Also:
neil.hauge: review+


Attachments
proposed patch against head (10.48 KB, patch)
2011-06-10 08:33 EDT, Karen Butzke CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nan Li CLA 2011-06-02 17:15:13 EDT
Build Identifier: I20110525-0800

1. Create a brand new JPA project with a mapping xml created along with it (selecting "Create mapping file (orm.xml) checkbox" when creating the JPA project)
2. Right-click the created JPA project and select New -> JPA Entity to create an entity, select "Add to entity mappings in XML" checkbox when it shows, create a couple of fields for the entity, and hit Finish.

An error is reported saying 

An internal error occurred during: "Add entity to XML".
java.lang.NullPointerException
	at org.eclipse.jpt.jpa.ui.internal.wizards.entity.data.operation.NewEntityClassOperation$1.run(NewEntityClassOperation.java:411)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

And you can also see the fields created for the entity in step 2 are not written to the mapping XML at all.

Reproducible: Always
Comment 1 Karen Butzke CLA 2011-06-09 09:57:16 EDT
The key to reproducing this bug is that you have to make one of the fields an id field.
Comment 2 Karen Butzke CLA 2011-06-10 08:33:58 EDT
Created attachment 197767 [details]
proposed patch against head

This patch changes the JPA project synchronizers to be synchronous when editing the orm.xml file. This allows the model to be fully updated when one change is made before another change is made. This is necessary when changing the model in code.
Comment 3 Karen Butzke CLA 2011-06-24 08:04:58 EDT
checked in to HEAD for 3.0.1
Comment 4 Jolene Moffitt CLA 2011-08-03 13:13:11 EDT
Verified in Build I-3.4.0-20110731180834

Verified you can create an entity with an id attribute and add it to the orm.xml mapping file without error.  See the link to view test steps for
verification. http://wiki.eclipse.org/Dali_3.0.1