Note that there are some explanatory texts on larger screens.

plurals
  1. POHow sould persistance unit for EJB app using in memory database look like?
    primarykey
    data
    text
    <p>I have an Java app, which i used to test with this persistence unit with in memory Derby driver:</p> <pre><code>&lt;persistence-unit name="TestPU" transaction-type="RESOURCE_LOCAL"&gt; &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt; &lt;properties&gt; &lt;property name="hibernate.connection.url" value="jdbc:derby:memory:ProjectDB"/&gt; &lt;property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.EmbeddedDriver"/&gt; &lt;property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect"/&gt; &lt;property name="hibernate.hbm2ddl.auto" value="create-drop"/&gt; &lt;property name="hibernate.connection.username" value=""/&gt; &lt;property name="hibernate.connection.password" value=""/&gt; &lt;/properties&gt; </code></pre> <p></p> <p>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</p> <pre><code>&lt;persistence-unit name="moduleNamePU" transaction-type="JTA"&gt; &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt; &lt;jta-data-source&gt;jdbc/sample&lt;/jta-data-source&gt; &lt;properties&gt; &lt;property name="hibernate.hbm2ddl.auto" value="create-drop"/&gt; &lt;/properties&gt; </code></pre> <p></p> <p>How can i alter the second persistence unit in order to work with in memory db?</p> <p>EDIT: As an EJB container i use Glassfish 3.1</p> <p>Entity Service:</p> <pre><code>@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; } } </code></pre> <p>Dao Layer service:</p> <pre><code>@Stateless public class EntityDao implements EntityDaoLocal { @PersistenceContext private EntityManager em; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload