Hi all,
I'm using JPA and Hibernate to persist my data.
Implementing it as per the documentation I found on the play website works fine.
However, I thought it would be nicer if I was able to consolidate most of the details back into the persistence.xml
(sounds more standard..... JPA like).
so, rather than have the url, username, and password filled out in the application.conf file,
I added them to the persistence.xml file.,, leaving in the application.conf file only:
db.default.jndiName=DefaultDS
jpa.default=defaultPersistenceUnit
and my persistence.xml file looks like this:
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="defaultPersistenceUnit"
transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<non-jta-data-source>DefaultDS</non-jta-data-source>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
<!-- can be create/validate/update/create-drop -->
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="javax.persistence.jdbc.url" value="jdbc:h2:tcp://localhost/~/dplay1"/>
<property name="javax.persistence.jdbc.user" value="sa" />
<property name="javax.persistence.jdbc.password" value="sa" />
</properties>
</persistence-unit>
</persistence>
I had hoped that would be enough.
However, I seemed to be wrong.
Not only does it complain about authentication being wrong (if all I comment out is username/password) it doesn't like If I comment out the URL. Even though the url and authentication details are all in the persistence.xml.
Is there anyway to get Play happy about the above?
Regards,
Sean