users@glassfish.java.net

Re: Same app twice using JPA

From: Sahoo <Sahoo_at_Sun.COM>
Date: Fri, 22 Jun 2007 19:28:51 +0530

Hi Edson Richter,

TopLink maintains a map of PU names to EMF (this is actually a bug in
the current implementation). This map is global for all the applications
in the JVM, because TopLink is loaded by a class loader which is the
parent of all application class loaders. You are probably *not* closing
the EMF when the app gets undeployed. So, when the app is re-deployed,
the old EMF is used. Try doing emf.close() in the code that gets called
when the app is undeployed. The relationship between undeployment and
redeployment is that an app first gets undeployed when it is redeployed.
You should be able to find some hooks in the app which gets called
during undeployment.

Thanks,
Sahoo

Edson Carlos Ericksson Richter wrote:
>
>> Why can't you have 2 different PU names in 2 different
>> persistence.xml files (that reference the same Entities - this
>> shouldn't be the problem)?
>>
>> thanks,
>> -marina
> Actually, I don't have 2 different persistence.xml... It's only 1 app
> being deployied twice - only connection setting is changed on final
> WAR, just before deployment (much like if I open the WAR with WinZip,
> edit Persistence.xml to set new connection settings, then update WAR).
>
>
> Regards,
>
> Edson Richter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>