persistence@glassfish.java.net

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

From: Tom Ware <tom.ware_at_oracle.com>
Date: Mon, 09 Jan 2006 13:57:08 -0500

Hi Pramod,

  I must admit I am not an expert on the expectations for your beta
software, but I'll give you my opinion of the severity of this bug and I
you can decide if it fits the criteria for inclusion in the beta.

- createEntityManagerFactory() is API that will likely not be called
particularly often with the setting that causes tables to be created and
that setting will be limited to people who are just getting started.
- it will, however, cause issues that are potentially difficult to
diagnose since tables that may contain data will be potentially recreated.
- it is quite easy to workaround since disabling table creating makes
the issue go away.
- users on production systems will never have this issue since they will
already have tables

-Tom

Pramod Gopinath wrote:

>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
>>
>>
>>
>>
>>
>
>
>

-- 
Tom Ware
Principal Software Engineer
Oracle Canada Inc.
Direct: (613) 783-4598
Email: tom.ware_at_oracle.com