title: What to put into jta-data-source of persistence.xml?
body: <p>What value should I place into <code>&lt;jta-data-source&gt;</code> of my <code>persistence.xml</code>?</p>
  
  <p>In glassfish admin panel I created a datasource name <code>"abcDS"</code>. In my <code>jndi.properties</code> (inside <code>src/test/resources</code>) I defined it like this:</p>
  
  <pre><code>[...]
  abcDS=new://Resource?type=DataSource
  abcDS.JdbcDriver=org.hsqldb.jdbcDriver
  abcDS.JdbcUrl=jdbc:hsqldb:mem:testdb
  abcDS.JtaManaged=true
  [...]
  </code></pre>
  
  <p>What shall I place into <code>persistence.xml</code>? I've found a lot of variants in the Net, like: <code>"jdbc/abcDS"</code>, <code>"java:/abcDS"</code>, <code>"abcDS"</code>. Which one is right? And is there some rule for this? I understand that it's related to JNDI, but...</p>
  
  <p>I'm trying to create EMF in my unit test:</p>
  
  <pre><code>EntityManagerFactory emf = Persistence.createEntityManagerFactory("abc");
  </code></pre>
  
  <p>This is what I'm getting in log:</p>
  
  <pre><code>[...]
  SEVERE: Could not find datasource: abcDS javax.naming.NameNotFoundException: 
      Name "abcDS" not found.
  at org.apache.openejb.core.ivm.naming.IvmContext.federate(IvmContext.java:193)
  at org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:150)
  at org.apache.openejb.core.ivm.naming.ContextWrapper.lookup(ContextWrapper.java:115)
  at javax.naming.InitialContext.lookup(InitialContext.java:392)
  [...]
  </code></pre>