Examples of DatabaseLogin


Examples of oracle.toplink.essentials.sessions.DatabaseLogin

            //build or retrieve the field definition.
            FieldDefinition fieldDef = getFieldDefFromDBField(dbField, isPKField);
            if (isPKField) {
                // Check if the generation strategy is IDENTITY
                String sequenceName = desc.getSequenceNumberName();
                DatabaseLogin login = project.getLogin();
                Sequence seq = login.getSequence(sequenceName);
                if(seq instanceof DefaultSequence) {
                    seq = login.getDefaultSequence();
                }
                //The native sequence whose value should be aquired after insert is identity sequence
                boolean isIdentity = seq instanceof NativeSequence && seq.shouldAcquireValueAfterInsert();
                fieldDef.setIsIdentity(isIdentity);
            }
View Full Code Here

Examples of oracle.toplink.essentials.sessions.DatabaseLogin

    private ClassTransformer buildTransformer(PersistenceUnitInfo unitInfo, Writer logWriter, int logLevel) {
        //persistenceUnitInfo = unitInfo;
        ClassLoader privateClassLoader = unitInfo.getNewTempClassLoader();

        // create server session (it should be done before initializing ServerPlatform)
        ServerSession session = new ServerSession(new Project(new DatabaseLogin()));
        session.setLogLevel(logLevel);
        if(logWriter!=null){
            ((DefaultSessionLog)session.getSessionLog()).setWriter(logWriter);
         }
       
View Full Code Here

Examples of oracle.toplink.sessions.DatabaseLogin

          "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);
View Full Code Here

Examples of oracle.toplink.sessions.DatabaseLogin

          "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);
View Full Code Here

Examples of oracle.toplink.sessions.DatabaseLogin

          "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);
View Full Code Here

Examples of org.eclipse.persistence.sessions.DatabaseLogin

    scriptRunner.runScript(br);
  }

  @Override
  public DatabaseSession getNewDatabaseSession() {
    DatabaseLogin login = new DatabaseLogin();
    login.setUserName(configuration.getDatabaseUser());
    login.setPassword(configuration.getDatabasePassword());
    login.setDatasourcePlatform(databasePlatform);
    login.setDatabaseURL(configuration.getDatabaseUrl());
    login.setDriverClassName(configuration.getDatabaseDriver());


    return new DatabaseSessionImpl(login);
  }
View Full Code Here

Examples of org.eclipse.persistence.sessions.DatabaseLogin

            //build or retrieve the field definition.
            FieldDefinition fieldDef = getFieldDefFromDBField(dbField, isPKField);
            if (isPKField) {
                // Check if the generation strategy is IDENTITY
                String sequenceName = desc.getSequenceNumberName();
                DatabaseLogin login = project.getLogin();
                Sequence seq = login.getSequence(sequenceName);
                if(seq instanceof DefaultSequence) {
                    seq = login.getDefaultSequence();
                }
                //The native sequence whose value should be acquired after insert is identity sequence
                boolean isIdentity = seq instanceof NativeSequence && seq.shouldAcquireValueAfterInsert();
                fieldDef.setIsIdentity(isIdentity);
            }
View Full Code Here

Examples of org.eclipse.persistence.sessions.DatabaseLogin

    private ClassTransformer buildTransformer(PersistenceUnitInfo unitInfo, Writer logWriter, int logLevel) {
        //persistenceUnitInfo = unitInfo;
        ClassLoader privateClassLoader = unitInfo.getNewTempClassLoader();

        // create server session (it should be done before initializing ServerPlatform)
        ServerSession session = new ServerSession(new Project(new DatabaseLogin()));
        session.setLogLevel(logLevel);
        if(logWriter!=null){
            ((DefaultSessionLog)session.getSessionLog()).setWriter(logWriter);
         }
       
View Full Code Here

Examples of org.eclipse.persistence.sessions.DatabaseLogin

    protected void prepareProjectLogin(Project project, Login login) {
        if (login != null) {
            project.setLogin(login);
        } else if (project.getDatasourceLogin() == null) {
            // dummy login that needs to be set, otherwise session creation will fail
            project.setLogin(new DatabaseLogin());
        } else {
            // we read a login from the deployment xml of java, don't overwrite
        }
    }
View Full Code Here

Examples of org.eclipse.persistence.sessions.DatabaseLogin

     * Build a DatabaseLogin for the given Session
     * Wrapped by the getLogin() call, therefore, config can't be null at this
     * point.
     */
    protected Login buildDatabaseLoginConfig(DatabaseLoginConfig databaseLoginConfig) {
        DatabaseLogin databaseLogin = new DatabaseLogin();

        // Driver class
        String driverClassName = databaseLoginConfig.getDriverClass();
        if (driverClassName != null) {
            try {
                Class driverClass = m_classLoader.loadClass(driverClassName);
                databaseLogin.setDriverClass(driverClass);
            } catch (Exception exception) {
                throw SessionLoaderException.failedToLoadTag("driver-class", driverClassName, exception);
            }
        }

        // Connection URL
        String connectionString = databaseLoginConfig.getConnectionURL();
        if (connectionString != null) {
            databaseLogin.setConnectionString(connectionString);
        }

        // Datasource
        String datasourceName = databaseLoginConfig.getDatasource();
        if (datasourceName != null) {
            try {
                JNDIConnector jndiConnector = new JNDIConnector(new javax.naming.InitialContext(), datasourceName);
                jndiConnector.setLookupType(databaseLoginConfig.getLookupType().intValue());
                databaseLogin.setConnector(jndiConnector);
            } catch (Exception exception) {
                throw SessionLoaderException.failedToLoadTag("datasource", datasourceName, exception);
            }
        }

        // Bind all parameters - XML Schema default is false
        databaseLogin.setShouldBindAllParameters(databaseLoginConfig.getBindAllParameters());

        // Cache all statements - XML Schema default is false
        databaseLogin.setShouldCacheAllStatements(databaseLoginConfig.getCacheAllStatements());

        // Byte array binding - XML Schema default is true
        databaseLogin.setUsesByteArrayBinding(databaseLoginConfig.getByteArrayBinding());

        // String binding - XML Schema default is false
        databaseLogin.setUsesStringBinding(databaseLoginConfig.getStringBinding());

        // Stream binding - XML Schema default is false
        databaseLogin.setUsesStreamsForBinding(databaseLoginConfig.getStreamsForBinding());

        // Force field to uppper case - XML Schema default is false
        databaseLogin.setShouldForceFieldNamesToUpperCase(databaseLoginConfig.getForceFieldNamesToUppercase());

        // Optimize data conversion - XML Schema default is true
        databaseLogin.setShouldOptimizeDataConversion(databaseLoginConfig.getOptimizeDataConversion());

        // Trim strings - XML Schema default is true
        databaseLogin.setShouldTrimStrings(databaseLoginConfig.getTrimStrings());

        // Batch writing - XML Schema default is false
        databaseLogin.setUsesBatchWriting(databaseLoginConfig.getBatchWriting());

        // JDBC 2.0 batch writing - XML Schema default is true
        databaseLogin.setUsesJDBCBatchWriting(databaseLoginConfig.getJdbcBatchWriting());

        // Max batch writing size - XML Schema default is 32000
        Integer maxBatchWritingSize = databaseLoginConfig.getMaxBatchWritingSize();
        if (maxBatchWritingSize != null) {
            databaseLogin.setMaxBatchWritingSize(maxBatchWritingSize.intValue());
        }

        // Native SQL - XML Schema default is false
        databaseLogin.setUsesNativeSQL(databaseLoginConfig.getNativeSQL());

        // Process the common elements in LoginConfig
        processLoginConfig(databaseLoginConfig, databaseLogin);

        processStructConverterConfig(databaseLoginConfig.getStructConverterConfig(), databaseLogin);
       
        if (databaseLoginConfig.isConnectionHealthValidatedOnError() != null){
            databaseLogin.setConnectionHealthValidatedOnError(databaseLoginConfig.isConnectionHealthValidatedOnError());
        }
        if (databaseLoginConfig.getQueryRetryAttemptCount() != null){
            databaseLogin.setQueryRetryAttemptCount(databaseLoginConfig.getQueryRetryAttemptCount());
        }
        if (databaseLoginConfig.getDelayBetweenConnectionAttempts() != null){
            databaseLogin.setDelayBetweenConnectionAttempts(databaseLoginConfig.getDelayBetweenConnectionAttempts());
        }
        if (databaseLoginConfig.getPingSQL() != null){
            databaseLogin.setPingSQL(databaseLoginConfig.getPingSQL());
        }
       
        // Finally, return the newly created DatabaseLogin
        return databaseLogin;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.