persistence@glassfish.java.net

Re: [Fwd: [Issue 119] New - DDL generation code executed on running sessions in Java SE]

From: Pramod Gopinath <Pramod.Gopinath_at_Sun.COM>
Date: Mon, 09 Jan 2006 10:51:02 -0800

Hi Tom
Thanks for filing this bug. The last time when the code for
autodetection of the database driver was checked in, we missed checking
in the code (that you had suggested) to detect if the session is logging
in for the first time (i.e. session.isConnected()).
I have a question for you on this issue : Do you think that we should we
backport this change to the beta code base too. Based on the simple
tests that I had run I do not think that users would run into this
issue. So I was thinking of making the code changes to the main trunk
only and not do it to the beta code base.
Wanted to know what is your opinion on this issue ?

Will send the code changes out today for you review.

Thanks
Pramod
> -------- Original Message --------
> Subject: [Issue 119] New - DDL generation code executed on running sessions in
> Java SE
> Date: Wed, 21 Dec 2005 15:22:02 í??
> From: tware_at_dev.java.net
> Reply-To: issues_at_glassfish.dev.java.net
> To: issues_at_glassfish.dev.java.net
>
> https://glassfish.dev.java.net/issues/show_bug.cgi?id=119
> Issue #|119
> Summary|DDL generation code executed on running sessions in Ja
> |va SE
> Component|glassfish
> Version|9.0pe
> Platform|All
> OS/Version|All
> URL|
> Status|NEW
> Status whiteboard|
> Keywords|
> Resolution|
> Issue type|DEFECT
> Priority|P3
> Subcomponent|entity-persistence
> Assigned to|mvatkina
> Reported by|tware
>
>
>
>
>
>
> ------- Additional comments from tware_at_dev.java.net Wed Dec 21 15:22:02 +0000
> 2005 -------
> The following code appears to have an issue if createEntityManagerFactory is
> called twice for the same Persistence Unit
>
> public EntityManagerFactory createEntityManagerFactory(String emName,
> Map m){
> String name = emName;
> if (name == null){
> name = "";
> }
> ServerSession session = getServerSession(name, m);
> if (session != null){
> EntityManagerFactory emf = new EntityManagerFactoryImpl(session);
> login(session, getPersistenceUnitProperties(name, m));
> generateDDLFiles(session, getPersistenceUnitProperties(name, m),
> true);
> return emf;
> }
> return null;
> }
>
> If the session is already logged in when this code is called, it means the
> tables should already be created. This means that the call to generateDDLFiles
> will overwrite already existing tables.
>
> We should change this code to only create tables at the time of 1st login
>
>
>