Monday, November 26, 2012

JPA 2.0 and Spring - persistence.xml not validated

Yesterday, while running a simple application that required JPA 2.0 and Spring framework, I hit a strange error.
Value '2.0' of attribute 'version' of element 'persistence' is not valid with respect to the corresponding attribute use. Attribute 'version' has a fixed value of '1.0'. junit
The solution is actually very simple one you understand the cause.
The problem is releted to the dependencies: the project held a denpendency to spring-jpa-2.0.8 which implements the JPA 1 specification.

So, to solve, I simply changed the dependency to spring-data-jpa-1.1.0.RELEASE.