My current project is using JPA, heavily. JPA is a spec/standard/interface and I’m using the Hibernate implementation for it, but I import the entities from a different maven module. The entities module has a dependency on JPA, but not on Hibernate. So when I run my unit tests, I suddenly get a:
Openjpa? Where does that come from?
The colleague who is developing the entities module uses openjpa for testing, so it’s declared with a test scope. The source code does not reference PersitenceCapable anywhere, so we were quite baffled as to where that reference lies.
It turns out that openjpa preferably instruments entity classes at compile time, so my colleague did that in the maven pom with a plugin:
That plugin outputs entity class files which do have a dependency on openjpa.