Example usage for java.sql ResultSetMetaData isNullable

List of usage examples for java.sql ResultSetMetaData isNullable

Introduction

In this page you can find the example usage for java.sql ResultSetMetaData isNullable.

Prototype

int isNullable(int column) throws SQLException;

Source Link

Document

Indicates the nullability of values in the designated column.

Usage

From source file:Main.java

public static void main(String[] args) throws Exception {
    Class.forName(DRIVER);/*from   w  w  w .j  a  v a 2 s  . c  o m*/
    Connection connection = DriverManager.getConnection(URL, USERNAME, PASSWORD);

    Statement statement = connection.createStatement();
    ResultSet resultSet = statement.executeQuery("SELECT id, username FROM users");
    ResultSetMetaData metadata = resultSet.getMetaData();
    int nullability = metadata.isNullable(1);

    if (nullability == ResultSetMetaData.columnNullable) {
        System.out.println("Columns ID can have a null value");
    } else if (nullability == ResultSetMetaData.columnNoNulls) {
        System.out.println("Columns ID does not allowed to have a null value");
    } else if (nullability == ResultSetMetaData.columnNullableUnknown) {
        System.out.println("Nullability unknown");
    }
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Connection conn = getMySqlConnection();
    System.out.println("Got Connection.");
    Statement st = conn.createStatement();
    st.executeUpdate("drop table survey;");
    st.executeUpdate("create table survey (id int,name varchar(30));");
    st.executeUpdate("insert into survey (id,name ) values (1,'nameValue')");

    st = conn.createStatement();//from w w  w.ja v a2s  . c  o m
    ResultSet rs = st.executeQuery("SELECT * FROM survey");

    ResultSetMetaData rsMetaData = rs.getMetaData();

    int numberOfColumns = rsMetaData.getColumnCount();
    System.out.println("resultSet MetaData column Count=" + numberOfColumns);

    for (int i = 1; i <= numberOfColumns; i++) {
        System.out.println("column MetaData ");
        System.out.println("column number " + i);

        // indicates the nullability of values
        // in the designated column.
        System.out.println(rsMetaData.isNullable(i));
    }

    st.close();
    conn.close();
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Connection conn = getConnection();

    Statement st = conn.createStatement();

    st.executeUpdate("create table survey (id int,myDate DATE);");
    String INSERT_RECORD = "insert into survey(id, myDate) values(?, ?)";

    PreparedStatement pstmt = conn.prepareStatement(INSERT_RECORD);
    pstmt.setString(1, "1");
    java.sql.Date sqlDate = new java.sql.Date(new java.util.Date().getTime());
    pstmt.setDate(2, sqlDate);//from   ww w .jav a 2s . com

    pstmt.executeUpdate();

    ResultSet rs = st.executeQuery("SELECT * FROM survey");

    ResultSetMetaData rsmd = rs.getMetaData();

    int numCols = rsmd.getColumnCount();

    System.out.print("\t");
    for (int i = 1; i <= numCols; i++) {
        System.out.println(rsmd.getColumnLabel(i));
    }

    System.out.print("\nAuto Increment\t");
    for (int i = 1; i <= numCols; i++) {
        System.out.println(rsmd.isAutoIncrement(i));
    }
    for (int i = 1; i <= numCols; i++) {

        System.out.println(rsmd.isCaseSensitive(i));
    }
    System.out.print("\nSearchable\t");
    for (int i = 1; i <= numCols; i++) {

        System.out.println(rsmd.isSearchable(i));
    }
    System.out.print("\nCurrency\t");
    for (int i = 1; i <= numCols; i++) {
        System.out.println(rsmd.isCurrency(i));
    }
    System.out.print("\nAllows nulls\t");
    for (int i = 1; i <= numCols; i++) {

        System.out.println(rsmd.isNullable(i));
    }
    System.out.print("\nSigned\t");
    for (int i = 1; i <= numCols; i++) {

        System.out.println(rsmd.isSigned(i));
    }
    System.out.print("\nRead only\t");
    for (int i = 1; i <= numCols; i++) {

        System.out.println(rsmd.isReadOnly(i));
    }
    System.out.print("\nWritable\t");
    for (int i = 1; i <= numCols; i++) {

        System.out.print(rsmd.isWritable(i));
    }
    System.out.print("\nDefinitely Writable\t");
    for (int i = 1; i <= numCols; i++) {

        System.out.println(rsmd.isDefinitelyWritable(i));
    }

    conn.close();
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Connection conn = getMySqlConnection();
    System.out.println("Got Connection.");
    Statement st = conn.createStatement();
    st.executeUpdate("drop table survey;");
    st.executeUpdate("create table survey (id int,name varchar(30));");
    st.executeUpdate("insert into survey (id,name ) values (1,'nameValue')");

    st = conn.createStatement();/* w  w w  . j a  v  a2 s.  c  om*/
    ResultSet rs = st.executeQuery("SELECT * FROM survey");

    ResultSetMetaData rsMetaData = rs.getMetaData();

    int numberOfColumns = rsMetaData.getColumnCount();
    System.out.println("resultSet MetaData column Count=" + numberOfColumns);

    for (int i = 1; i <= numberOfColumns; i++) {
        System.out.println("column MetaData ");
        System.out.println("column number " + i);
        System.out.println(rsMetaData.getColumnDisplaySize(i));
        System.out.println(rsMetaData.getColumnLabel(i));
        System.out.println(rsMetaData.getColumnName(i));
        System.out.println(rsMetaData.getColumnType(i));
        System.out.println(rsMetaData.getColumnTypeName(i));
        System.out.println(rsMetaData.getColumnClassName(i));
        System.out.println(rsMetaData.getTableName(i));
        System.out.println(rsMetaData.getPrecision(i));
        System.out.println(rsMetaData.getScale(i));
        System.out.println(rsMetaData.isAutoIncrement(i));
        System.out.println(rsMetaData.isCurrency(i));
        System.out.println(rsMetaData.isWritable(i));
        System.out.println(rsMetaData.isDefinitelyWritable(i));
        System.out.println(rsMetaData.isNullable(i));
        System.out.println(rsMetaData.isReadOnly(i));
        System.out.println(rsMetaData.isCaseSensitive(i));
        System.out.println(rsMetaData.isSearchable(i));
        System.out.println(rsMetaData.isSigned(i));
        System.out.println(rsMetaData.getCatalogName(i));
        System.out.println(rsMetaData.getSchemaName(i));
    }
    st.close();
    conn.close();
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Connection conn = getMySqlConnection();
    System.out.println("Got Connection.");
    Statement st = conn.createStatement();
    st.executeUpdate("drop table survey;");
    st.executeUpdate("create table survey (id int,name varchar(30));");
    st.executeUpdate("insert into survey (id,name ) values (1,'nameValue')");

    st = conn.createStatement();/*ww  w.j av a 2  s .  co m*/
    ResultSet rs = st.executeQuery("SELECT * FROM survey");

    ResultSetMetaData rsMetaData = rs.getMetaData();

    int numberOfColumns = rsMetaData.getColumnCount();
    System.out.println("resultSet MetaData column Count=" + numberOfColumns);

    for (int i = 1; i <= numberOfColumns; i++) {
        System.out.println("column MetaData ");
        System.out.println("column number " + i);
        // indicates the designated column's normal maximum width in
        // characters
        System.out.println(rsMetaData.getColumnDisplaySize(i));
        // gets the designated column's suggested title
        // for use in printouts and displays.
        System.out.println(rsMetaData.getColumnLabel(i));
        // get the designated column's name.
        System.out.println(rsMetaData.getColumnName(i));

        // get the designated column's SQL type.
        System.out.println(rsMetaData.getColumnType(i));

        // get the designated column's SQL type name.
        System.out.println(rsMetaData.getColumnTypeName(i));

        // get the designated column's class name.
        System.out.println(rsMetaData.getColumnClassName(i));

        // get the designated column's table name.
        System.out.println(rsMetaData.getTableName(i));

        // get the designated column's number of decimal digits.
        System.out.println(rsMetaData.getPrecision(i));

        // gets the designated column's number of
        // digits to right of the decimal point.
        System.out.println(rsMetaData.getScale(i));

        // indicates whether the designated column is
        // automatically numbered, thus read-only.
        System.out.println(rsMetaData.isAutoIncrement(i));

        // indicates whether the designated column is a cash value.
        System.out.println(rsMetaData.isCurrency(i));

        // indicates whether a write on the designated
        // column will succeed.
        System.out.println(rsMetaData.isWritable(i));

        // indicates whether a write on the designated
        // column will definitely succeed.
        System.out.println(rsMetaData.isDefinitelyWritable(i));

        // indicates the nullability of values
        // in the designated column.
        System.out.println(rsMetaData.isNullable(i));

        // Indicates whether the designated column
        // is definitely not writable.
        System.out.println(rsMetaData.isReadOnly(i));

        // Indicates whether a column's case matters
        // in the designated column.
        System.out.println(rsMetaData.isCaseSensitive(i));

        // Indicates whether a column's case matters
        // in the designated column.
        System.out.println(rsMetaData.isSearchable(i));

        // indicates whether values in the designated
        // column are signed numbers.
        System.out.println(rsMetaData.isSigned(i));

        // Gets the designated column's table's catalog name.
        System.out.println(rsMetaData.getCatalogName(i));

        // Gets the designated column's table's schema name.
        System.out.println(rsMetaData.getSchemaName(i));
    }

    st.close();
    conn.close();
}

From source file:org.jabsorb.ext.DataList.java

/**
 * Build an array of ColumnMetaData object from a ResultSetMetaData object.
 *
 * @param rmd ResultSetMetaData to build ColumnMetaData from.
 * @return ColumnMetaData array or null if ResultSetMetaData is null.
 *
 * @throws SQLException if there is a problem processing the 
 * ResultSetMetaData object.//from  w  w  w . j a va2  s  .co  m
 */
public static ColumnMetaData[] buildColumnMetaDataFromResultSetMetaData(ResultSetMetaData rmd)
        throws SQLException {
    if (rmd == null) {
        return null;
    }

    int j = rmd.getColumnCount();

    ColumnMetaData[] cmd = new ColumnMetaData[j];

    for (int i = 1; i <= j; i++) {
        ColumnMetaData c = new ColumnMetaData();

        c.setColumnName(rmd.getColumnName(i));
        c.setCatalogName(rmd.getCatalogName(i));
        c.setColumnClassName(rmd.getColumnClassName(i));
        c.setColumnDisplaySize(rmd.getColumnDisplaySize(i));
        c.setColumnLabel(rmd.getColumnLabel(i));
        c.setColumnType(rmd.getColumnType(i));
        c.setColumnTypeName(rmd.getColumnTypeName(i));
        c.setPrecision(rmd.getPrecision(i));
        c.setScale(rmd.getScale(i));
        c.setSchemaName(rmd.getSchemaName(i));
        c.setTableName(rmd.getTableName(i));
        c.setAutoIncrement(rmd.isAutoIncrement(i));
        c.setCaseSensitive(rmd.isCaseSensitive(i));
        c.setCurrency(rmd.isCurrency(i));
        c.setNullable(rmd.isNullable(i));
        c.setReadOnly(rmd.isReadOnly(i));
        c.setSearchable(rmd.isSearchable(i));
        c.setSigned(rmd.isSigned(i));
        c.setWritable(rmd.isWritable(i));
        c.setDefinitelyWritable(rmd.isDefinitelyWritable(i));

        cmd[i - 1] = c;
    }
    return cmd;
}

From source file:ch.cern.db.flume.sink.kite.util.InferSchemaFromTable.java

public Schema getSchema() throws SQLException {

    FieldAssembler<Schema> builder = SchemaBuilder.record("log").fields();

    Connection connection = DriverManager.getConnection(connection_url, connection_user, connection_password);

    Statement statement = connection.createStatement();
    String query = "SELECT * " + "FROM " + tableName + " WHERE 0=1";

    LOG.info("Running query for obtaining metadata: " + query);

    ResultSet result = statement.executeQuery(query);
    ResultSetMetaData metadata = result.getMetaData();
    int columnCount = metadata.getColumnCount();

    for (int i = 1; i <= columnCount; i++) {
        String columnName = metadata.getColumnName(i);
        int columnType = metadata.getColumnType(i);

        boolean nullable = metadata.isNullable(i) != ResultSetMetaData.columnNoNulls;

        FieldTypeBuilder<Schema> field = builder.name(columnName).doc("SQL type: " + columnType).type();

        switch (columnType) {
        case java.sql.Types.SMALLINT:
        case java.sql.Types.TINYINT:
        case java.sql.Types.INTEGER:
        case java.sql.Types.BIGINT:
            if (nullable)
                field.nullable().intType().noDefault();
            else/*from   www  .j av  a  2  s . c  om*/
                field.intType().noDefault();
            break;
        case java.sql.Types.BOOLEAN:
            if (nullable)
                field.nullable().booleanType().noDefault();
            else
                field.booleanType().noDefault();
            break;
        case java.sql.Types.NUMERIC:
        case java.sql.Types.DOUBLE:
        case java.sql.Types.FLOAT:
            if (nullable)
                field.nullable().doubleType().noDefault();
            else
                field.doubleType().noDefault();
            break;
        case java.sql.Types.TIMESTAMP:
        case -101: //TIMESTAMP(3) WITH TIME ZONE
        case -102: //TIMESTAMP(6) WITH LOCAL TIME ZONE
        default:
            if (nullable)
                field.nullable().stringType().noDefault();
            else
                field.stringType().noDefault();
            break;
        }
    }

    return builder.endRecord();
}

From source file:org.jtalks.poulpe.util.databasebackup.persistence.DbTableData.java

/**
 * Constructs a new ColumnMetaData objects from given ResultSetMetaData with provided column default values map and
 * the object's index.//from  ww w .j a  va  2  s .co  m
 * 
 * @param rsmd
 *            A ResultSetMetaData which contains meta information about all columns for the table.
 * @param columnDefaultValues
 *            A map of possibly defined values by default for columns.
 * @param i
 *            Index of column which should be constructed.
 * @return A constructed ColumnMetaData object.
 * @throws SQLException
 *             Is thrown in case any errors during work with database occur.
 */
private ColumnMetaData getColumnMetaData(ResultSetMetaData rsmd, Map<String, String> columnDefaultValues, int i)
        throws SQLException {
    SqlTypes columnType = SqlTypes.getSqlTypeByJdbcSqlType(rsmd.getColumnType(i));

    ColumnMetaData column = ColumnMetaData.getInstance(rsmd.getColumnName(i), columnType)
            .setNullable(rsmd.isNullable(i) == ResultSetMetaData.columnNullable)
            .setAutoincrement(rsmd.isAutoIncrement(i));
    if (columnDefaultValues.containsKey(rsmd.getColumnName(i))) {
        column.setDefaultValue(columnDefaultValues.get(rsmd.getColumnName(i)));
    }
    if (columnType.isHasSize()) {
        column.setSize(rsmd.getColumnDisplaySize(i));
    }
    return column;
}

From source file:org.apache.calcite.avatica.jdbc.JdbcMeta.java

/**
 * Convert from JDBC metadata to Avatica columns.
 *//*from  w  w  w .  jav a  2 s  .c o m*/
protected static List<ColumnMetaData> columns(ResultSetMetaData metaData) throws SQLException {
    if (metaData == null) {
        return Collections.emptyList();
    }
    final List<ColumnMetaData> columns = new ArrayList<>();
    for (int i = 1; i <= metaData.getColumnCount(); i++) {
        final SqlType sqlType = SqlType.valueOf(metaData.getColumnType(i));
        final ColumnMetaData.Rep rep = ColumnMetaData.Rep.of(sqlType.internal);
        ColumnMetaData.AvaticaType t = ColumnMetaData.scalar(metaData.getColumnType(i),
                metaData.getColumnTypeName(i), rep);
        ColumnMetaData md = new ColumnMetaData(i - 1, metaData.isAutoIncrement(i), metaData.isCaseSensitive(i),
                metaData.isSearchable(i), metaData.isCurrency(i), metaData.isNullable(i), metaData.isSigned(i),
                metaData.getColumnDisplaySize(i), metaData.getColumnLabel(i), metaData.getColumnName(i),
                metaData.getSchemaName(i), metaData.getPrecision(i), metaData.getScale(i),
                metaData.getTableName(i), metaData.getCatalogName(i), t, metaData.isReadOnly(i),
                metaData.isWritable(i), metaData.isDefinitelyWritable(i), metaData.getColumnClassName(i));
        columns.add(md);
    }
    return columns;
}

From source file:org.apache.fineract.infrastructure.dataexport.helper.DataExportUtils.java

/**
 * Gets the meta data of the columns of the specified table
 * //from ww w .  j a  v  a  2 s.  c  o m
 * @param tableName
 * @param jdbcTemplate
 * @return List of {@link EntityColumnMetaData} objects
 */
public static List<EntityColumnMetaData> getTableColumnsMetaData(final String tableName,
        final JdbcTemplate jdbcTemplate) {
    final List<EntityColumnMetaData> entityColumnsMetaData = new ArrayList<>();
    final List<String> columnNames = new ArrayList<>();
    final DataExportCoreTable coreTable = DataExportCoreTable.newInstance(tableName);
    Set<String> columnsToBeRemovedFromListsOfEntityColumns = new HashSet<>(
            Arrays.asList(DataExportEntityColumnName.TRANSFER_TO_OFFICE_ID, DataExportEntityColumnName.VERSION,
                    DataExportEntityColumnName.IMAGE_ID, DataExportEntityColumnName.ACCOUNT_TYPE_ENUM,
                    DataExportEntityColumnName.DEPOSIT_TYPE_ENUM, DataExportEntityColumnName.SUB_STATUS,
                    DataExportEntityColumnName.FULL_NAME));

    try {
        // see - http://dev.mysql.com/doc/refman/5.7/en/limit-optimization.html
        // LIMIT 0 quickly returns an empty set. This can be useful for checking the validity of a query. 
        // It can also be employed to obtain the types of the result columns if you are using a MySQL API 
        // that makes result set metadata available.
        final ResultSetMetaData resultSetMetaData = jdbcTemplate
                .query("select * from " + tableName + " limit 0", new ResultSetExtractor<ResultSetMetaData>() {

                    @Override
                    public ResultSetMetaData extractData(ResultSet rs)
                            throws SQLException, DataAccessException {
                        return rs.getMetaData();
                    }
                });

        if (resultSetMetaData != null) {
            final int numberOfColumns = resultSetMetaData.getColumnCount();

            for (int i = 1; i <= numberOfColumns; i++) {
                String columnName = resultSetMetaData.getColumnName(i);
                String columnLabel = resultSetMetaData.getColumnName(i);
                String columnType = resultSetMetaData.getColumnTypeName(i);
                Integer columnIsNullable = resultSetMetaData.isNullable(i);
                boolean isNullable = (columnIsNullable != 0);

                if (coreTable != null) {
                    switch (coreTable) {
                    case M_LOAN_TRANSACTION:
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.UNRECOGNIZED_INCOME_PORTION);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.SUSPENDED_INTEREST_PORTION_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.SUSPENDED_FEE_CHARGES_PORTION_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.SUSPENDED_PENALTY_CHARGES_PORTION_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.OUTSTANDING_LOAN_BALANCE_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.RECOVERED_PORTION_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.PAYMENT_DETAIL_ID);
                        columnsToBeRemovedFromListsOfEntityColumns.add(DataExportEntityColumnName.OFFICE_ID);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.IS_ACCCOUNT_TRANSFER);
                        columnsToBeRemovedFromListsOfEntityColumns.add(DataExportEntityColumnName.APPUSER_ID);
                        columnsToBeRemovedFromListsOfEntityColumns.add(DataExportEntityColumnName.EXTERNAL_ID);
                        columnsToBeRemovedFromListsOfEntityColumns.add(DataExportEntityColumnName.CREATED_DATE);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.TRANSACTION_TYPE_ENUM);
                        columnsToBeRemovedFromListsOfEntityColumns.add(DataExportEntityColumnName.LOAN_ID);
                        columnsToBeRemovedFromListsOfEntityColumns.add(DataExportEntityColumnName.AMOUNT);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.PRINCIPAL_PORTION_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.INTEREST_PORTION_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.FEE_CHARGES_PORTION_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.PENALTY_CHARGES_PORTION_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.OVERPAYMENT_PORTION_DERIVED);
                        break;

                    case M_SAVINGS_ACCOUNT_TRANSACTION:
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.OVERDRAFT_AMOUNT_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.RUNNING_BALANCE_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.CUMULATIVE_BALANCE_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.BALANCE_NUMBER_OF_DAYS_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.BALANCE_END_DATE_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns.add(DataExportEntityColumnName.CREATED_DATE);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.TRANSACTION_TYPE_ENUM);
                        columnsToBeRemovedFromListsOfEntityColumns.add(DataExportEntityColumnName.APPUSER_ID);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.SAVINGS_ACCOUNT_ID);
                        columnsToBeRemovedFromListsOfEntityColumns.add(DataExportEntityColumnName.AMOUNT);
                        break;

                    case M_LOAN_REPAYMENT_SCHEDULE:
                        columnsToBeRemovedFromListsOfEntityColumns.add(DataExportEntityColumnName.ID);
                        columnsToBeRemovedFromListsOfEntityColumns.add(DataExportEntityColumnName.LOAN_ID);
                        columnsToBeRemovedFromListsOfEntityColumns.add(DataExportEntityColumnName.FROMDATE);
                        columnsToBeRemovedFromListsOfEntityColumns.add(DataExportEntityColumnName.INSTALLMENT);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.PRINCIPAL_COMPLETED_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.PRINCIPAL_WRITTENOFF_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.INTEREST_COMPLETED_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.INTEREST_WAIVED_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.INTEREST_WRITTENOFF_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.ACCRUAL_INTEREST_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.SUSPENDED_INTEREST_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.FEE_CHARGES_WRITTENOFF_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.FEE_CHARGES_COMPLETED_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.FEE_CHARGES_WAIVED_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.ACCRUAL_FEE_CHARGES_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.SUSPENDED_FEE_CHARGES_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.PENALTY_CHARGES_COMPLETED_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.PENALTY_CHARGES_WAIVED_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.PENALTY_CHARGES_WRITTEN_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.ACCRUAL_PENALTY_CHARGES_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.SUSPENDED_PENALTY_CHARGES_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.TOTAL_PAID_IN_ADVANCE_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.TOTAL_PAID_LATE_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.COMPLETED_DERIVED);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.CREATED_BY_ID);
                        columnsToBeRemovedFromListsOfEntityColumns.add(DataExportEntityColumnName.CREATED_DATE);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.LAST_MODIFIED_BY_ID);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.LAST_MODIFIED_DATE);
                        columnsToBeRemovedFromListsOfEntityColumns
                                .add(DataExportEntityColumnName.RECALCULATED_INTEREST_COMPONENT);
                        break;

                    default:
                        break;
                    }
                }

                if (!columnsToBeRemovedFromListsOfEntityColumns.contains(columnName)) {
                    if (columnName.equals(DataExportEntityColumnName.ID)) {
                        columnLabel = DataExportEntityColumnName.TRANSACTION_ID;
                    }
                    EntityColumnMetaData entityColumnMetaData = EntityColumnMetaData.newInstance(columnName,
                            columnLabel, columnType, isNullable);

                    entityColumnsMetaData.add(entityColumnMetaData);
                    columnNames.add(columnName);
                }
            }
        }
    }

    catch (Exception exception) {
        exception.printStackTrace();
    }

    return entityColumnsMetaData;
}