Community
Participate
Working Groups
Build Identifier: I-3.1.0-20111103164637 1. Create a JPA project 2. Create a separate source folder for metamodel (This is optional, just makes things clearer.) 3. Enable metamodel 4. Generate two or more entities from tables to a package, e.g. entity.gen 5. Open one of the entity in the editor and change its package name to another one, e.g. test.gen 6. Use quick fix to move the entity updated in step 3 to the new package There are a couple of errors at this point: 1. An error message is thrown in the error log complaining the entity updated in step 3 does not exist in the old package. Please see the attached stack traces. 2. Duplicate metamodel classes exist each of which in the old and the new package separately. Please see the attached picture. Clean project can make the metamodel class in the old package of the updated entity go away. Reproducible: Always
Created attachment 206819 [details] Stack Trace
Created attachment 206820 [details] Snapshoot
The error message seems to be caused by AbstractPersistenceUnit.validateClassRefs because we are trying to verify the existence of the class refs listed in the persistence.xml; however, one of the classes is already moved to the new package but the persistence.xml doesn't get updated when we are moving the entity to a new package through quick fix so the persistence.xml still refers to the old class path.
These problems seem to have been fixed by the major rework of JpaProjectManager. This is probably because JPA validation now runs with a lock on the project (before, it ran unprotected). I have tested this use case and it seems to make sense that the problem should no longer occur; but you never know.... :-) If this problem re-occurs, please re-open this bug.