Why does Hibernate ignore the JPA2 standardized properties in my persistence.xml?

Posted by Ophidian on Stack Overflow See other posts from Stack Overflow or by Ophidian
Published on 2010-04-17T23:31:30Z Indexed on 2010/04/17 23:33 UTC
Read the original article Hit count: 330

Filed under:
|
|
|

I have an extremely simple web application running in Tomcat using Spring 3.0.1, Hibernate 3.5.1, JPA 2, and Derby. I am defining all of my database connectivity in persistence.xml and merely using Spring for dependency injection. I am using embedded Derby as my database.

Everything works correctly when I define the driver and url properties in persistence.xml in the classic Hibernate manner as thus:

<property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="hibernate.connection.url" value="jdbc:derby:webdb;create=true"/>

The problems occur when I switch my configuration to the JPA2 standardized properties as thus:

<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:derby:webdb;create=true"/>

When using the JPA2 property keys, the application bails hard with the following exception:

java.lang.UnsupportedOperationException: The user must supply a JDBC connection

Does anyone know why this is failing?

NOTE: I have copied the javax... property strings straight from the Hibernate reference documentation, so a typo is extremely unlikely.

© Stack Overflow or respective owner

Related posts about java

Related posts about spring