users@glassfish.java.net

Re: JUnit tests with Glassfish EJB's

From: <glassfish_at_javadesktop.org>
Date: Wed, 24 Mar 2010 01:49:36 PDT

Sorry but that's not the case.

My persistence.xml looks like this:

[code]
<?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="testPU" transaction-type="JTA">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>jdbc/sample</jta-data-source>
    <properties>
      <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
    </properties>
  </persistence-unit>
</persistence>
[/code]

So the drop-and-create-tables option should clean the database for every test.

Besides I'm getting the following exception there:

javax.persistence.NoResultException: getSingleResult() did not retrieve any entities.
[Message sent by forum member 'walec51']

http://forums.java.net/jive/thread.jspa?messageID=393436