I need to create educational demo of java web-application using EJB.
I want to use maven embedded-glassfish plugin to simplify matter for people who will run this demo (so that they need not manually set up and configure glassfish server).
However, I could not understand how to force embedded-glassfish to use other database rather than temporary apache derby. I use Java Persistence API - and I want users to use permanent database, for example H2, started by my application (it starts all right).
I've tried straightforward idea - to configure what I need by persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="demoData" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:h2:tcp://127.0.0.1:12345/demodb"/>
<property name="javax.persistence.jdbc.user" value="sa"/>
<property name="javax.persistence.jdbc.password" value=""/>
<property name="eclipselink.ddl-generation" value="create-tables"/>
</properties>
</persistence-unit>
</persistence>
It is not ignored completely, it is loaded - but my JPA works with default database anyway. What can I do? Can I reconfigure jdbc/__default datasource somehow, or make my persistence file work? Thanks in advance!