Quote:
I ensured that
persistence-api was NOT in the classpath, but the error (see below) continued
Quote:
java.lang.NoSuchMethodError: javax.persistence.Persistence.getPersistenceUtil()Ljavax/persistence/PersistenceUtil;
I can this only happen if you have only the jpa api on the classpath, but no implementation. But maybe this is exactly what you have, since you don't seem to need JPA.
Quote:
I was able to solve the problem by excluding hibernate-jpa from the build. However, I'm confused about the following:
- Why did the error continue in spite of there being (only) hibernate-jpa in the classpath?
- What is the difference between JPATraversableResolver and any other TraversableResolver?
For the first question see above. Regarding the second,
TraversableResolver is not a concrete class, but an interface. There is however something like a default implementation if the interface which will for both methods of the interface (
isReachable and
isCascadable) will just always return
true. The idea is that in the case of JPA and lazy loaded association you want to avoid loading lazy data from the database in order to validate it. If it is already persistent in the database it should already have been validated and there is no need to retrieve and validate it again. Have a look at the Bean Validation specification if you want to know more.
--Hardy