I've boiled down a confusing situation into a reproducible odd behavior in the attached example application. In an OpenJPA-supported application when there are two classes (an abstract parent and a concrete child) that are both marked with @Entity, the classes are not enhanced when an autowired @Repository DAO is called from a unit test. The DAO contains an inserted @PersistenceContext to get access to the EntityManager.
If the call to the dao is commented out, the classes are enhanced as they should be.
Using spring-instrument-3.1.M2.jar on a -javaagent line.
- Run a mvn package with the dao call commented out and not commented out in the test class
- Observe the difference in openjpa reporting the enhancement of classes vs. not enhancing them
- It doesn't matter if you use a persistence.xml file or the new packagesToScan option in LocalContainerEntityManagerFactoryBean