persistence@glassfish.java.net

Re: what is the use of defaultSession?

From: Tom Ware <tom.ware_at_oracle.com>
Date: Fri, 25 Aug 2006 12:37:33 -0400

Hi Sahoo,

  This method is more commonly used in the non-JPA version of TopLink.

  I believe the only interaction it will have with a persistence unit
called "default" is that it will return the underlying session from that
persistence unit when called.

-Tom

Sanjeeb Kumar Sahoo wrote:

>Hi,
>
>SessionManager has a field called defaultSession defined as shown below:
>
>public class SessionManager {
> ...
> protected AbstractSession defaultSession;
> ...
>}
>
>This gets initialized on demand by some code that looks like this:
> public Session getDefaultSession() {
> if (defaultSession == null) {
> defaultSession = getSession("default");
> }
> return defaultSession;
> }
>
>What is the use of this defaultSession? Is it documented anywhere? Will
>it interfere with user's persistence unit named as *default*?
>
>Thanks,
>Sahoo
>
>

--