I have an Java app, which i used to test with this persistence unit with in memory Derby driver:
<persistence-unit name="TestPU" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.connection.url" value="jdbc:derby:memory:ProjectDB"/>
<property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.connection.username" value=""/>
<property name="hibernate.connection.password" value=""/>
</properties>
Now i added an EJB service layer and i have been unable to write a working persistence unit using the same in memory db since. The following works fine, but i'd like to have it in memory
<persistence-unit name="moduleNamePU" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/sample</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
</properties>
How can i alter the second persistence unit in order to work with in memory db?
EDIT: As an EJB container i use Glassfish 3.1
Entity Service:
@Stateless
@Local(value=EntityServiceLocal.class)
public class EntityService implements EntityServiceLocal {
@EJB
private EntityDaoLocal entityDao;
@Resource
private SessionContext ctx;
public void setEntityDao(EntityDaoLocal entityDao) {
this.entityDao = entityDao;
}
}
Dao Layer service:
@Stateless
public class EntityDao implements EntityDaoLocal {
@PersistenceContext
private EntityManager em;
}