Package oracle.toplink.sessions

Examples of oracle.toplink.sessions.DatabaseSession


    ClassLoader classLoader =
        (this.sessionClassLoader != null ? this.sessionClassLoader : ClassUtils.getDefaultClassLoader());

    // Initialize the TopLink Session, using the configuration file
    // and the session name.
    DatabaseSession session = loadDatabaseSession(this.configLocation, this.sessionName, classLoader);

    // It is possible for SessionManager to return a null Session!
    if (session == null) {
      throw new IllegalStateException(
          "A session named '" + this.sessionName + "' could not be loaded from resource [" +
          this.configLocation + "] using ClassLoader [" + classLoader + "]. " +
          "This is most likely a deployment issue: Can the class loader access the resource?");
    }

    DatabaseLogin login = (this.databaseLogin != null ? this.databaseLogin : session.getLogin());

    // Apply specified login properties to the DatabaseLogin instance.
    if (this.loginPropertyMap != null) {
      new BeanWrapperImpl(login).setPropertyValues(this.loginPropertyMap);
    }

    // Override default connection pool with specified DataSource, if any.
    if (this.dataSource != null) {
      login.setConnector(new JNDIConnector(this.dataSource));
      login.setUsesExternalConnectionPooling(true);
    }

    // Override default DatabasePlatform with specified one, if any.
    if (this.databasePlatform != null) {
      login.usePlatform(this.databasePlatform);
    }

    // Override default DatabaseLogin instance with specified one, if any.
    if (this.databaseLogin != null) {
      setDatabaseLogin(session, this.databaseLogin);
    }

    // Override default SessionLog with specified one, if any.
    if (this.sessionLog != null) {
      session.setSessionLog(this.sessionLog);
      session.logMessages();
    }

    // Log in and create corresponding SessionFactory.
    session.login();
    return newSessionFactory(session);
  }
View Full Code Here


    ClassLoader classLoader =
        (this.sessionClassLoader != null ? this.sessionClassLoader : ClassUtils.getDefaultClassLoader());

    // Initialize the TopLink Session, using the configuration file
    // and the session name.
    DatabaseSession session = loadDatabaseSession(this.configLocation, this.sessionName, classLoader);

    // It is possible for SessionManager to return a null Session!
    if (session == null) {
      throw new IllegalStateException(
          "A session named '" + this.sessionName + "' could not be loaded from resource [" +
          this.configLocation + "] using ClassLoader [" + classLoader + "]. " +
          "This is most likely a deployment issue: Can the class loader access the resource?");
    }

    DatabaseLogin login = (this.databaseLogin != null ? this.databaseLogin : session.getLogin());

    // Apply specified login properties to the DatabaseLogin instance.
    if (this.loginPropertyMap != null) {
      PropertyAccessorFactory.forBeanPropertyAccess(login).setPropertyValues(this.loginPropertyMap);
    }

    // Override default connection pool with specified DataSource, if any.
    if (this.dataSource != null) {
      login.setConnector(new JNDIConnector(this.dataSource));
      login.setUsesExternalConnectionPooling(true);
    }

    // Override default DatabasePlatform with specified one, if any.
    if (this.databasePlatform != null) {
      login.usePlatform(this.databasePlatform);
    }

    // Override default DatabaseLogin instance with specified one, if any.
    if (this.databaseLogin != null) {
      setDatabaseLogin(session, this.databaseLogin);
    }

    // Override default SessionLog with specified one, if any.
    if (this.sessionLog != null) {
      session.setSessionLog(this.sessionLog);
      session.logMessages();
    }

    // Log in and create corresponding SessionFactory.
    session.login();
    return newSessionFactory(session);
  }
View Full Code Here

    ClassLoader classLoader =
        (this.sessionClassLoader != null ? this.sessionClassLoader : ClassUtils.getDefaultClassLoader());

    // Initialize the TopLink Session, using the configuration file
    // and the session name.
    DatabaseSession session = loadDatabaseSession(this.configLocation, this.sessionName, classLoader);

    // It is possible for SessionManager to return a null Session!
    if (session == null) {
      throw new IllegalStateException(
          "A session named '" + this.sessionName + "' could not be loaded from resource [" +
          this.configLocation + "] using ClassLoader [" + classLoader + "]. " +
          "This is most likely a deployment issue: Can the class loader access the resource?");
    }

    DatabaseLogin login = (this.databaseLogin != null ? this.databaseLogin : session.getLogin());

    // Apply specified login properties to the DatabaseLogin instance.
    if (this.loginPropertyMap != null) {
      new BeanWrapperImpl(login).setPropertyValues(this.loginPropertyMap);
    }

    // Override default connection pool with specified DataSource, if any.
    if (this.dataSource != null) {
      login.setConnector(new JNDIConnector(this.dataSource));
      login.setUsesExternalConnectionPooling(true);
    }

    // Override default DatabasePlatform with specified one, if any.
    if (this.databasePlatform != null) {
      login.usePlatform(this.databasePlatform);
    }

    // Override default DatabaseLogin instance with specified one, if any.
    if (this.databaseLogin != null) {
      setDatabaseLogin(session, this.databaseLogin);
    }

    // Override default SessionLog with specified one, if any.
    if (this.sessionLog != null) {
      session.setSessionLog(this.sessionLog);
      session.logMessages();
    }

    // Log in and create corresponding SessionFactory.
    session.login();
    return newSessionFactory(session);
  }
View Full Code Here

TOP

Related Classes of oracle.toplink.sessions.DatabaseSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.