Example usage for java.sql PreparedStatement setBigDecimal

List of usage examples for java.sql PreparedStatement setBigDecimal

Introduction

In this page you can find the example usage for java.sql PreparedStatement setBigDecimal.

Prototype

void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException;

Source Link

Document

Sets the designated parameter to the given java.math.BigDecimal value.

Usage

From source file:org.kuali.kfs.gl.batch.dataaccess.impl.LedgerPreparedStatementCachingDaoJdbc.java

public void updateBalance(final Balance balance, final Timestamp currentTimestamp) {
    new UpdatingJdbcWrapper<Balance>() {
        @Override//from  w  w w. j a  v  a  2  s  .  c o m
        protected void populateStatement(PreparedStatement preparedStatement) throws SQLException {
            preparedStatement.setBigDecimal(1, balance.getAccountLineAnnualBalanceAmount().bigDecimalValue());
            preparedStatement.setBigDecimal(2, balance.getBeginningBalanceLineAmount().bigDecimalValue());
            preparedStatement.setBigDecimal(3,
                    balance.getContractsGrantsBeginningBalanceAmount().bigDecimalValue());
            preparedStatement.setBigDecimal(4, balance.getMonth1Amount().bigDecimalValue());
            preparedStatement.setBigDecimal(5, balance.getMonth2Amount().bigDecimalValue());
            preparedStatement.setBigDecimal(6, balance.getMonth3Amount().bigDecimalValue());
            preparedStatement.setBigDecimal(7, balance.getMonth4Amount().bigDecimalValue());
            preparedStatement.setBigDecimal(8, balance.getMonth5Amount().bigDecimalValue());
            preparedStatement.setBigDecimal(9, balance.getMonth6Amount().bigDecimalValue());
            preparedStatement.setBigDecimal(10, balance.getMonth7Amount().bigDecimalValue());
            preparedStatement.setBigDecimal(11, balance.getMonth8Amount().bigDecimalValue());
            preparedStatement.setBigDecimal(12, balance.getMonth9Amount().bigDecimalValue());
            preparedStatement.setBigDecimal(13, balance.getMonth10Amount().bigDecimalValue());
            preparedStatement.setBigDecimal(14, balance.getMonth11Amount().bigDecimalValue());
            preparedStatement.setBigDecimal(15, balance.getMonth12Amount().bigDecimalValue());
            preparedStatement.setBigDecimal(16, balance.getMonth13Amount().bigDecimalValue());
            preparedStatement.setTimestamp(17, currentTimestamp);
            preparedStatement.setInt(18, balance.getUniversityFiscalYear());
            preparedStatement.setString(19, balance.getChartOfAccountsCode());
            preparedStatement.setString(20, balance.getAccountNumber());
            preparedStatement.setString(21, balance.getSubAccountNumber());
            preparedStatement.setString(22, balance.getObjectCode());
            preparedStatement.setString(23, balance.getSubObjectCode());
            preparedStatement.setString(24, balance.getBalanceTypeCode());
            preparedStatement.setString(25, balance.getObjectTypeCode());
        }
    }.execute(Balance.class);
}

From source file:org.kuali.kfs.gl.batch.dataaccess.impl.LedgerPreparedStatementCachingDaoJdbc.java

public void insertEncumbrance(final Encumbrance encumbrance, final Timestamp currentTimestamp) {
    new InsertingJdbcWrapper<Encumbrance>() {
        @Override/*from w ww  .  j  a v a  2  s  .c  o m*/
        protected void populateStatement(PreparedStatement preparedStatement) throws SQLException {
            preparedStatement.setInt(1, encumbrance.getUniversityFiscalYear());
            preparedStatement.setString(2, encumbrance.getChartOfAccountsCode());
            preparedStatement.setString(3, encumbrance.getAccountNumber());
            preparedStatement.setString(4, encumbrance.getSubAccountNumber());
            preparedStatement.setString(5, encumbrance.getObjectCode());
            preparedStatement.setString(6, encumbrance.getSubObjectCode());
            preparedStatement.setString(7, encumbrance.getBalanceTypeCode());
            preparedStatement.setString(8, encumbrance.getDocumentTypeCode());
            preparedStatement.setString(9, encumbrance.getOriginCode());
            preparedStatement.setString(10, encumbrance.getDocumentNumber());
            preparedStatement.setString(11, encumbrance.getTransactionEncumbranceDescription());
            preparedStatement.setDate(12, encumbrance.getTransactionEncumbranceDate());
            preparedStatement.setBigDecimal(13,
                    encumbrance.getAccountLineEncumbranceAmount().bigDecimalValue());
            preparedStatement.setBigDecimal(14,
                    encumbrance.getAccountLineEncumbranceClosedAmount().bigDecimalValue());
            preparedStatement.setString(15, encumbrance.getAccountLineEncumbrancePurgeCode());
            preparedStatement.setTimestamp(16, currentTimestamp);
        }
    }.execute(Encumbrance.class);
}

From source file:org.kuali.kfs.gl.batch.dataaccess.impl.LedgerPreparedStatementCachingDaoJdbc.java

public void updateEncumbrance(final Encumbrance encumbrance, final Timestamp currentTimestamp) {
    new UpdatingJdbcWrapper<Encumbrance>() {
        @Override//from   w  w w .  ja v a  2 s  .  c  o m
        protected void populateStatement(PreparedStatement preparedStatement) throws SQLException {
            preparedStatement.setString(1, encumbrance.getTransactionEncumbranceDescription());
            preparedStatement.setDate(2, encumbrance.getTransactionEncumbranceDate());
            preparedStatement.setBigDecimal(3, encumbrance.getAccountLineEncumbranceAmount().bigDecimalValue());
            preparedStatement.setBigDecimal(4,
                    encumbrance.getAccountLineEncumbranceClosedAmount().bigDecimalValue());
            preparedStatement.setString(5, encumbrance.getAccountLineEncumbrancePurgeCode());
            preparedStatement.setTimestamp(6, currentTimestamp);
            preparedStatement.setInt(7, encumbrance.getUniversityFiscalYear());
            preparedStatement.setString(8, encumbrance.getChartOfAccountsCode());
            preparedStatement.setString(9, encumbrance.getAccountNumber());
            preparedStatement.setString(10, encumbrance.getSubAccountNumber());
            preparedStatement.setString(11, encumbrance.getObjectCode());
            preparedStatement.setString(12, encumbrance.getSubObjectCode());
            preparedStatement.setString(13, encumbrance.getBalanceTypeCode());
            preparedStatement.setString(14, encumbrance.getDocumentTypeCode());
            preparedStatement.setString(15, encumbrance.getOriginCode());
            preparedStatement.setString(16, encumbrance.getDocumentNumber());
        }
    }.execute(Encumbrance.class);
}

From source file:org.kuali.kfs.gl.batch.dataaccess.impl.LedgerPreparedStatementCachingDaoJdbc.java

public void insertExpenditureTransaction(final ExpenditureTransaction expenditureTransaction) {
    new InsertingJdbcWrapper<ExpenditureTransaction>() {
        @Override/*w ww .  ja  va  2 s . c o m*/
        protected void populateStatement(PreparedStatement preparedStatement) throws SQLException {
            preparedStatement.setInt(1, expenditureTransaction.getUniversityFiscalYear());
            preparedStatement.setString(2, expenditureTransaction.getChartOfAccountsCode());
            preparedStatement.setString(3, expenditureTransaction.getAccountNumber());
            preparedStatement.setString(4, expenditureTransaction.getSubAccountNumber());
            preparedStatement.setString(5, expenditureTransaction.getObjectCode());
            preparedStatement.setString(6, expenditureTransaction.getSubObjectCode());
            preparedStatement.setString(7, expenditureTransaction.getBalanceTypeCode());
            preparedStatement.setString(8, expenditureTransaction.getObjectTypeCode());
            preparedStatement.setString(9, expenditureTransaction.getUniversityFiscalAccountingPeriod());
            preparedStatement.setString(10, expenditureTransaction.getProjectCode());
            preparedStatement.setString(11, expenditureTransaction.getOrganizationReferenceId());
            preparedStatement.setBigDecimal(12,
                    expenditureTransaction.getAccountObjectDirectCostAmount().bigDecimalValue());
        }
    }.execute(ExpenditureTransaction.class);
}

From source file:org.kuali.kfs.gl.batch.dataaccess.impl.LedgerPreparedStatementCachingDaoJdbc.java

public void updateExpenditureTransaction(final ExpenditureTransaction expenditureTransaction) {
    new UpdatingJdbcWrapper<ExpenditureTransaction>() {
        @Override/* w  w  w .  j  av  a2s .  com*/
        protected void populateStatement(PreparedStatement preparedStatement) throws SQLException {
            preparedStatement.setBigDecimal(1,
                    expenditureTransaction.getAccountObjectDirectCostAmount().bigDecimalValue());
            preparedStatement.setInt(2, expenditureTransaction.getUniversityFiscalYear());
            preparedStatement.setString(3, expenditureTransaction.getChartOfAccountsCode());
            preparedStatement.setString(4, expenditureTransaction.getAccountNumber());
            preparedStatement.setString(5, expenditureTransaction.getSubAccountNumber());
            preparedStatement.setString(6, expenditureTransaction.getObjectCode());
            preparedStatement.setString(7, expenditureTransaction.getSubObjectCode());
            preparedStatement.setString(8, expenditureTransaction.getBalanceTypeCode());
            preparedStatement.setString(9, expenditureTransaction.getObjectTypeCode());
            preparedStatement.setString(10, expenditureTransaction.getUniversityFiscalAccountingPeriod());
            preparedStatement.setString(11, expenditureTransaction.getProjectCode());
            preparedStatement.setString(12, expenditureTransaction.getOrganizationReferenceId());
        }
    }.execute(ExpenditureTransaction.class);
}

From source file:org.kuali.kfs.gl.batch.dataaccess.impl.LedgerPreparedStatementCachingDaoJdbc.java

public void insertSufficientFundBalances(final SufficientFundBalances sufficientFundBalances,
        final Timestamp currentTimestamp) {
    new InsertingJdbcWrapper<SufficientFundBalances>() {
        @Override/*  w w  w .ja  va  2s.  c o m*/
        protected void populateStatement(PreparedStatement preparedStatement) throws SQLException {
            preparedStatement.setInt(1, sufficientFundBalances.getUniversityFiscalYear());
            preparedStatement.setString(2, sufficientFundBalances.getChartOfAccountsCode());
            preparedStatement.setString(3, sufficientFundBalances.getAccountNumber());
            preparedStatement.setString(4, sufficientFundBalances.getFinancialObjectCode());
            preparedStatement.setString(5, sufficientFundBalances.getAccountSufficientFundsCode());
            preparedStatement.setBigDecimal(6,
                    sufficientFundBalances.getCurrentBudgetBalanceAmount().bigDecimalValue());
            preparedStatement.setBigDecimal(7,
                    sufficientFundBalances.getAccountActualExpenditureAmt().bigDecimalValue());
            preparedStatement.setBigDecimal(8,
                    sufficientFundBalances.getAccountEncumbranceAmount().bigDecimalValue());
            preparedStatement.setTimestamp(9, currentTimestamp);
        }
    }.execute(SufficientFundBalances.class);
}

From source file:org.kuali.kfs.gl.batch.dataaccess.impl.LedgerPreparedStatementCachingDaoJdbc.java

public void updateSufficientFundBalances(final SufficientFundBalances sufficientFundBalances,
        final Timestamp currentTimestamp) {
    new UpdatingJdbcWrapper<SufficientFundBalances>() {
        @Override//  w  w  w .  ja  v a2 s.  c o  m
        protected void populateStatement(PreparedStatement preparedStatement) throws SQLException {
            preparedStatement.setString(1, sufficientFundBalances.getAccountSufficientFundsCode());
            preparedStatement.setBigDecimal(2,
                    sufficientFundBalances.getCurrentBudgetBalanceAmount().bigDecimalValue());
            preparedStatement.setBigDecimal(3,
                    sufficientFundBalances.getAccountActualExpenditureAmt().bigDecimalValue());
            preparedStatement.setBigDecimal(4,
                    sufficientFundBalances.getAccountEncumbranceAmount().bigDecimalValue());
            preparedStatement.setTimestamp(5, currentTimestamp);
            preparedStatement.setInt(6, sufficientFundBalances.getUniversityFiscalYear());
            preparedStatement.setString(7, sufficientFundBalances.getChartOfAccountsCode());
            preparedStatement.setString(8, sufficientFundBalances.getAccountNumber());
            preparedStatement.setString(9, sufficientFundBalances.getFinancialObjectCode());
        }
    }.execute(SufficientFundBalances.class);
}

From source file:org.kuali.kfs.gl.batch.dataaccess.impl.LedgerPreparedStatementCachingDaoJdbc.java

public void insertEntry(final Entry entry, final Timestamp currentTimestamp) {
    new InsertingJdbcWrapper<Entry>() {
        @Override//from   w  ww.j a v a2s . c o  m
        protected void populateStatement(PreparedStatement preparedStatement) throws SQLException {
            preparedStatement.setInt(1, entry.getUniversityFiscalYear());
            preparedStatement.setString(2, entry.getChartOfAccountsCode());
            preparedStatement.setString(3, entry.getAccountNumber());
            preparedStatement.setString(4, entry.getSubAccountNumber());
            preparedStatement.setString(5, entry.getFinancialObjectCode());
            preparedStatement.setString(6, entry.getFinancialSubObjectCode());
            preparedStatement.setString(7, entry.getFinancialBalanceTypeCode());
            preparedStatement.setString(8, entry.getFinancialObjectTypeCode());
            preparedStatement.setString(9, entry.getUniversityFiscalPeriodCode());
            preparedStatement.setString(10, entry.getFinancialDocumentTypeCode());
            preparedStatement.setString(11, entry.getFinancialSystemOriginationCode());
            preparedStatement.setString(12, entry.getDocumentNumber());
            preparedStatement.setInt(13, entry.getTransactionLedgerEntrySequenceNumber());
            preparedStatement.setString(14, entry.getTransactionLedgerEntryDescription());
            preparedStatement.setBigDecimal(15, entry.getTransactionLedgerEntryAmount().bigDecimalValue());
            preparedStatement.setString(16, entry.getTransactionDebitCreditCode());
            preparedStatement.setDate(17, entry.getTransactionDate());
            preparedStatement.setString(18, entry.getOrganizationDocumentNumber());
            preparedStatement.setString(19, entry.getProjectCode());
            preparedStatement.setString(20, entry.getOrganizationReferenceId());
            preparedStatement.setString(21, entry.getReferenceFinancialDocumentTypeCode());
            preparedStatement.setString(22, entry.getReferenceFinancialSystemOriginationCode());
            preparedStatement.setString(23, entry.getReferenceFinancialDocumentNumber());
            preparedStatement.setDate(24, entry.getFinancialDocumentReversalDate());
            preparedStatement.setString(25, entry.getTransactionEncumbranceUpdateCode());
            preparedStatement.setDate(26, entry.getTransactionPostingDate());
            preparedStatement.setTimestamp(27, currentTimestamp);
        }
    }.execute(Entry.class);
}

From source file:org.kuali.kfs.gl.batch.dataaccess.impl.LedgerPreparedStatementCachingDaoJdbc.java

public void insertReversal(final Reversal reversal) {
    new InsertingJdbcWrapper<Reversal>() {
        @Override//from  w  w w. j  a  va2s  . c o  m
        protected void populateStatement(PreparedStatement preparedStatement) throws SQLException {
            preparedStatement.setDate(1, reversal.getFinancialDocumentReversalDate());
            preparedStatement.setInt(2, reversal.getUniversityFiscalYear());
            preparedStatement.setString(3, reversal.getChartOfAccountsCode());
            preparedStatement.setString(4, reversal.getAccountNumber());
            preparedStatement.setString(5, reversal.getSubAccountNumber());
            preparedStatement.setString(6, reversal.getFinancialObjectCode());
            preparedStatement.setString(7, reversal.getFinancialSubObjectCode());
            preparedStatement.setString(8, reversal.getFinancialBalanceTypeCode());
            preparedStatement.setString(9, reversal.getFinancialObjectTypeCode());
            preparedStatement.setString(10, reversal.getUniversityFiscalPeriodCode());
            preparedStatement.setString(11, reversal.getFinancialDocumentTypeCode());
            preparedStatement.setString(12, reversal.getFinancialSystemOriginationCode());
            preparedStatement.setString(13, reversal.getDocumentNumber());
            preparedStatement.setInt(14, reversal.getTransactionLedgerEntrySequenceNumber());
            preparedStatement.setString(15, reversal.getTransactionLedgerEntryDescription());
            preparedStatement.setBigDecimal(16, reversal.getTransactionLedgerEntryAmount().bigDecimalValue());
            preparedStatement.setString(17, reversal.getTransactionDebitCreditCode());
            preparedStatement.setDate(18, reversal.getTransactionDate());
            preparedStatement.setString(19, reversal.getOrganizationDocumentNumber());
            preparedStatement.setString(20, reversal.getProjectCode());
            preparedStatement.setString(21, reversal.getOrganizationReferenceId());
            preparedStatement.setString(22, reversal.getReferenceFinancialDocumentTypeCode());
            preparedStatement.setString(23, reversal.getReferenceFinancialSystemOriginationCode());
            preparedStatement.setString(24, reversal.getReferenceFinancialDocumentNumber());
            preparedStatement.setString(25, reversal.getTransactionEncumbranceUpdateCode());
            preparedStatement.setDate(26, reversal.getTransactionPostingDate());
        }
    }.execute(Reversal.class);
}

From source file:org.latticesoft.util.resource.dao.Param.java

private void setValueToStatement(Object o, PreparedStatement pstmt) throws SQLException {
    if (log.isDebugEnabled()) {
        log.debug(this.sqlIndex + "=" + o);
    }/*from  w  ww  .j a  v a2s  .  c  o m*/
    switch (this.sqlType) {
    case Types.VARCHAR:
    case Types.CHAR:
        String s = (String) o;
        pstmt.setString(this.sqlIndex, s);
        break;
    case Types.BOOLEAN:
        if (o != null && o instanceof Boolean) {
            boolean b = ((Boolean) o).booleanValue();
            pstmt.setBoolean(this.sqlIndex, b);
        }
        break;
    case Types.INTEGER:
        if (o != null && o instanceof Integer) {
            int i = ((Integer) o).intValue();
            pstmt.setInt(this.sqlIndex, i);
        }
        break;
    case Types.SMALLINT:
        if (o != null && o instanceof Short) {
            short ss = ((Short) o).shortValue();
            pstmt.setShort(this.sqlIndex, ss);
        }
        break;
    case Types.TINYINT:
        if (o != null && o instanceof Byte) {
            byte bb = ((Byte) o).byteValue();
            pstmt.setByte(this.sqlIndex, bb);
        }
        break;
    case Types.BIGINT:
        if (o != null && o instanceof Long) {
            long l = ((Long) o).longValue();
            pstmt.setLong(this.sqlIndex, l);
        }
        break;
    case Types.DOUBLE:
        if (o != null && o instanceof Double) {
            double dd = ((Double) o).doubleValue();
            pstmt.setDouble(this.sqlIndex, dd);
        }
        break;
    case Types.FLOAT:
        if (o != null && o instanceof Float) {
            float f = ((Float) o).floatValue();
            pstmt.setFloat(this.sqlIndex, f);
        }
        break;
    case Types.NUMERIC:
        if (o != null && o instanceof BigDecimal) {
            BigDecimal bd = (BigDecimal) o;
            pstmt.setBigDecimal(this.sqlIndex, bd);
        }
        break;
    case Types.TIMESTAMP:
        if (o != null && o instanceof Timestamp) {
            Timestamp ts = (Timestamp) o;
            pstmt.setTimestamp(this.sqlIndex, ts);
        }
        break;
    case Types.NULL:
        if (log.isDebugEnabled()) {
            log.debug(this.sqlIndex + " IS NULL");
        }
        pstmt.setNull(this.sqlIndex, Types.NULL);
        break;
    default:
        if (o != null) {
            pstmt.setObject(this.sqlIndex, o);
        }
    }
}