I have a small application that uses eclipselink and sqlite. This works
perfectly except for the testing. I have no clue how to tell EJBContainer
to use eclipselink as provider. It is setup in persistence.xml:
<persistence-unit name="evedb" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>org.ronsmits.eveasset.evedomain.BluePrint</class>
<class>org.ronsmits.eveasset.evedomain.EveItem</class>
<jta-data-source>evedb</jta-data-source>
<properties>
<property name="eclipselink.ddl-generation" value="create-tables"/>
<property name="eclipselink.logging.file" value="/tmp/output.log"/>
<property name="eclipselink.logging.logger" value="JavaLogger"/>
<property name="eclipselink.logging.level" value="SEVERE"/>
</properties>
</persistence-unit>
My resource for the database is:
<resources>
<Resource id="evedb" type="javax.sql.DataSource">
jdbcDriver = org.sqlite.JDBC
jdbcUrl = jdbc:sqlite:${db}
</Resource>
</resources>
(The ${db} gets filled in by maven)
My test case starts with setting up the EJBContainer:
@Before
public void setUp() throws NamingException {
Properties p = new Properties();
p.put("evedb", "new://Resource?type=DataSource");
p.put("evedb.JdbcDriver", "org.sqlite.JDBC");
p.put("evedb.JdbcUrl",
"jdbc:sqlite:/home/ron/Downloads/sqlite-latest.sqlite");
container = EJBContainer.createEJBContainer(p);
container.getContext().bind("inject", this);
}
The tests are not even run as EJBContainer tries to start the persistence
with openJPA instead of with eclipselink. Now I have seen that there is a
tomee-plume package nowadays but I can imagine this has a solution that I
am completely overlooking.
Any help?
Ron
I Haven’t Lost My Mind - It’s Backed Up On Disk Somewhere