users@glassfish.java.net

local transactions (RESOURCE_LOCAL) and automatic table creation in GF 3

From: <glassfish_at_javadesktop.org>
Date: Wed, 14 Apr 2010 05:31:37 PDT

Hi,

   I'm using GF 3 and Derby (10.5.3). If my application uses local transaction, is it possible automatic tables creation (as with JTA transactions)? Below are my persistence.xml and the session bean code. When I deploy it nothing happens (no tables).

    Thanks for any help.

   Leandro

<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="Exercicio_CP_01-ejbPU" transaction-type="RESOURCE_LOCAL">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <non-jta-data-source>jdbc/exercicio_cp_01</non-jta-data-source>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>
    <properties>
      <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
      <property name="eclipselink.logging.level" value="FINE"/>
    </properties>
  </persistence-unit>
</persistence>

and my session beans is


@Stateless
public class Servicos implements ServicosLocal {

  @PersistenceUnit(unitName = "Exercicio_CP_01-ejbPU")
  EntityManagerFactory emf;

  private EntityManager em;

  @PostConstruct
  protected void init() {
    em = emf.createEntityManager();
  }

  @PreDestroy
  protected void fim() {
    em.close();
  }

   //other public methods
}
[Message sent by forum member 'leandro_komosinski']

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