This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 258235

Summary: NB fails to rebuild static metamodel if org.eclipse.persistence is removed from pom.xml
Product: javaee Reporter: omniprof
Component: PersistenceAssignee: Sergey Petrov <sj-nb>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.1   
Hardware: PC   
OS: Windows 10 x64   
Issue Type: DEFECT Exception Reporter:

Description omniprof 2016-03-04 02:01:02 UTC
I have discovered the following:

A Maven project is first created with org.eclipse.persistence dependencies so that the static metamodels are created. The dependencies are added when the persistence.xml file is created.

Clean and build and the generated sources appear with the static metadata for the entities.

Remove the org.eclipse.persistence dependencies from the pom.xml 

Clean and build and the generated resources are removed.

This is the expected behaviour.

Restore the org.eclipse.persistence dependencies to the pom.xml

Clean and build and the generated sources do not appear.

I discoveded that the only way to restore the generated static metamodel is to edit the persistence.xml file in some minor way so that it is saved.

Clean and build and the generated sources reappear.

Should not NetBeans check for generated sources on every clean and build regardless of whether the persistence.xml, I suspect, has a newer timestamp from a fresh save? Or is this possibly a Maven issue?

As a teacher I frequently change code as part of a lecture and had I not spotted this annomaly tonight I would have looked foolish in tomorrow's class. As it stands I will look a bit silly as I explain that you must kick (save it without changes) the persistence.xml file to regenerate static metadata.
Comment 1 omniprof 2016-03-04 03:02:21 UTC
Further testing has revealed that sometimes kicking the file works and sometimes it does not. Even more confuing is that I have one sample program that never fails to generate the metamodels while another will no longer generate. I will use two different projects in class rather than modify an exiting project.
Comment 2 omniprof 2016-03-04 03:29:02 UTC
Final comment, if I open the persitence.xml and change the "Include all Entity Classes" check box, save the file, go back and restire the check to its original state, save the file and do a build rather than clean and build now the generated souces will appear. This appears to be consistent.

You can seee the project at

The SQL script for the MySQL world db is found in Other Test Sources. The servlet contains multiple types of queries but only the first is uncommented and is what I plan to use to demonstrate the static metamodel.