users@glassfish.java.net

Re: restart-domain executes eclipselink.ddl-generation setting

From: Mitesh Meswani <mitesh.meswani_at_oracle.com>
Date: Mon, 11 Feb 2013 13:41:07 -0800

Hi Bobby,
><property name="eclipselink.ddl-generation.output-mode" value="database"/>

Above property directs eclipselink to do java2db directly to database at
every EMF creation; thus, at restart a drop happens. Remove the property
from you PU.

Thanks,
Mitesh

On 2/11/2013 1:15 PM, Marina Vatkina wrote:
> Is it by any chance an OSGi bundle? If it is, it's not reladed - it's
> redeployed every time (at least it was).
>
> -marina
>
> On 2/11/13 12:44 PM, Bobby Bissett wrote:
>> On Mon, Feb 11, 2013 at 11:28 AM, Bobby Bissett <bbissett_at_gmail.com>
>> wrote:
>>> [...] Will verify that it happens again and will file an
>>> issue if so.
>> Yep, it happens over and over. I deploy my app with the
>> persistence.xml pasted below, register an initial user with my app,
>> and verify that app sees the user and I see the user in the db when I
>> query the database directly. Then I run "asadmin restart-domain" and
>> all of my tables are dropped. Reloading the app shows our "no users
>> are registered" page and viewing the data in the db directly shows all
>> the tables are empty.
>>
>> <?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="NameHerePU"
>> transaction-type="RESOURCE_LOCAL">
>> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
>> <non-jta-data-source>jdbc/namehere</non-jta-data-source>
>> <exclude-unlisted-classes>false</exclude-unlisted-classes>
>> <properties>
>> <property name="eclipselink.target-database" value="PostgreSQL"/>
>> <property name="eclipselink.show_sql" value="true"/>
>> <property name="eclipselink.ddl-generation.output-mode"
>> value="database"/>
>> <property name="eclipselink.ddl-generation"
>> value="drop-and-create-tables"/>
>> </properties>
>> </persistence-unit>
>> </persistence>
>>
>> Before I file an issue, do you see anything wrong with the
>> persistence.xml above? Also, under what category should this be filed.
>> I dunno if it's JPA issue since the server startup has to be calling
>> JPA and giving it some info telling it to do this.
>>
>> Thanks,
>> Bobby
>