Monday, December 20, 2010

JPA 2.0 with Spring 3.0 bug

I was trying to make a sample application using Spring3 and JPA2 on my new shiny IntelliJ IDEA 10, but stumbled quickly on a problem when I tried to run the application. Spring was complaining that the version attribute in my persistence.xml was wrong. It was set to "2.0", but Spring insisted that it could only be "1.0". I spent hours trying to figure out where the problem was. A wrong XMLSchema being picked up ? A problem with my JPA libraries ? A problem with my JPA provider ? No. The problem was coming from Spring itself (SPR-6711). Upgrading to Spring 3.0.5 fixed it. What a waste of time. It wouldn't have happened if I had used the latest libraries in the first place, instead of letting IDEA automatically import them (I guess version 3.0.0 were downloaded and added to my project).

No comments:

Post a Comment