persistence@glassfish.java.net

Re: toplink.ddl-generation set to create-tables, but tables are also being dropped!

From: Wonseok Kim <guruwons_at_gmail.com>
Date: Mon, 2 Apr 2007 21:31:13 +0900

Hi,
I found that GF container has bug if there is <property name="
toplink.ddl-generation.output-mode" value="both"/> property. This is not
required property in GF container, could you remove this? Then dropping
tables would not occur.

Marina,

PersistenceProcessor in cmp module is overriding property
toplink.ddl-generation with "drop-and-create-tables" in Line 468. If
toplink.ddl-generation.output-mode is "both", TopLink try to both generate
jdbc files and drop/create tables by itself. Hence,TopLink drops tables even
if user specified toplink.ddl-generation as "create-tables".
I think It should be fixed by overriding "toplink.ddl-generation.output-mode"
value to "sql-script" also when container try to generate DDLs.

Cheers,
-Wonseok

On 4/2/07, David Harrigan <dharrigan_at_gmail.com> wrote:
>
> Oh,
>
> and the obviously thing, I have checked the persistence.xml in the
> exploded directory of GF j2ee-apps directory, it's the only one there
> and it is the one for container managed control (i.e., no drop, just
> the create-tables line you have seen previously.)
>
> -=david=-
>
> On 4/2/07, David Harrigan <dharrigan_at_gmail.com> wrote:
> > Hi,
> >
> > Using GF with the embedded toplink essentials (JPA) reference
> > implementation. My version
> > of GF is > 41 (current promoted build is 41, I'm tracking CVS, so
> > maybe I'm a bit past that release version in terms of codebase).
> >
> > Outside of the container, I replace the persistence.xml with one that
> > drops/creates tables as I run my tests against derby on my local
> > machine, so I don't care what happens to that one :-)
> >
> > When I deploy, I have the persistence.xml as you have seen in my
> previous email.
> >
> > -=david=-
> >
> > On 4/2/07, Wonseok Kim <guruwons_at_gmail.com> wrote:
> > > Hi David,
> > > Are you using TopLink Essentials with the GlassFish container(Java EE
> mode)
> > > or Java SE mode without GF container? If you're using GF container,
> please
> > > post your version. The behavior of ddl generation is different
> depending on
> > > Java EE/SE mode.
> > >
> > > -Wonseok
> > >
> > >
> > > On 4/2/07, David Harrigan <dharrigan_at_gmail.com> wrote:
> > > > Hi,
> > > >
> > > > Currently tracking GF v2 on CVS (so I'm up past version 41).
> > > >
> > > > I'm noticing something that I wouldn't expect, so I hope someone can
> > > > help. In my persistence.xml I have the following properties set:
> > > >
> > > > <property name="toplink.logging.level" value="FINEST"/>
> > > > <property name="toplink.ddl-generation" value="create-tables"/>
> > > > <property name="toplink.application-location " value="/tmp"/>
> > > > <property name="toplink.create-ddl-jdbc-file-name"
> > > value="create.sql"/>
> > > > <property name="toplink.ddl-generation.output-mode"
> > > value="both"/>
> > > >
> > > > Yet, I notice that toplink (or GF) is generating this file (apart
> from
> > > > the create.sql) :
> > > >
> > > > mediaservice_mediaservice-ejb_mediaPu_dropDDL.jdbc
> > > >
> > > > (mediaservice is the name of my ear/ejb) and contained within it are
> > > > various drop statements:
> > > >
> > > > for example:
> > > >
> > > > ALTER TABLE ITEM DROP CONSTRAINT FK_ITEM_PROVIDER_PROVIDERID
> > > > ALTER TABLE ITEM DROP CONSTRAINT FK_ITEM_TAGS_TAGSID
> > > > ALTER TABLE ITEM DROP CONSTRAINT ITEM_RESTRICTION_RESTRICTIONID
> > > > DROP TABLE TAGS
> > > > DROP TABLE ITEMITEM
> > > > ...
> > > > ...
> > > >
> > > >
> > > > and so on.
> > > >
> > > > This is wiping out my test database each time. Obviously, I'm *very*
> > > > nervous that if in production I release my EAR our production
> > > > databases will be dropped....
> > > >
> > > > According to the JPA spec, create-tables should:
> > > >
> > > > create-tables - create DDL for non-existent tables; leave existing
> > > > tables unchanged
> > > >
> > > > (this is from
> > >
> http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-extensions.html#Java2DBSchemaGen
> )
> > > >
> > > > Is this a bug? Or something that I'm not quite understanding...
> > > >
> > > > Thanks.
> > > >
> > > > -=david=-
> > > >
> > > > --
> > > > PGP Key Id: E2BE72FC
> > > > Public Key: http://www.harrigan.info/public.asc
> > > >
> > >
> > >
> >
> >
> > --
> > PGP Key Id: E2BE72FC
> > Public Key: http://www.harrigan.info/public.asc
> >
>
>
> --
> PGP Key Id: E2BE72FC
> Public Key: http://www.harrigan.info/public.asc
>