Class OracleJDBCSelectorService


  • @Dependent
    public class OracleJDBCSelectorService
    extends Object
    Class representing Oracle JDBC functionality
    Author:
    balazs.joo
    • Constructor Detail

      • OracleJDBCSelectorService

        public OracleJDBCSelectorService()
    • Method Detail

      • selectFirstStringValue

        public String selectFirstStringValue​(String sql,
                                             String columnName)
                                      throws hu.icellmobilsoft.coffee.dto.exception.BaseException
        Run sql select command, and return given column String value
        Parameters:
        sql - sql command
        columnName - column name
        Returns:
        column String value
        Throws:
        hu.icellmobilsoft.coffee.dto.exception.BaseException - exception
      • selectFirstIntegerValue

        public Integer selectFirstIntegerValue​(String sql,
                                               String columnName)
                                        throws hu.icellmobilsoft.coffee.dto.exception.BaseException
        Run sql select command, and return given column Integer value
        Parameters:
        sql - sql command
        columnName - column name
        Returns:
        column Integer value
        Throws:
        hu.icellmobilsoft.coffee.dto.exception.BaseException - exception
      • selectFirstBooleanValue

        public Boolean selectFirstBooleanValue​(String sql,
                                               String columnName)
                                        throws hu.icellmobilsoft.coffee.dto.exception.BaseException
        Run sql select command, and return given column Boolean value
        Parameters:
        sql - sql command
        columnName - column name
        Returns:
        column Boolean value
        Throws:
        hu.icellmobilsoft.coffee.dto.exception.BaseException - exception
      • selectFirstBigDecimalValue

        public BigDecimal selectFirstBigDecimalValue​(String sql,
                                                     String columnName)
                                              throws hu.icellmobilsoft.coffee.dto.exception.BaseException
        Run sql select command, and return given column BigDecimal value
        Parameters:
        sql - sql command
        columnName - column name
        Returns:
        column BigDecimal value
        Throws:
        hu.icellmobilsoft.coffee.dto.exception.BaseException - exception
      • selectFirstDateValue

        public Date selectFirstDateValue​(String sql,
                                         String columnName)
                                  throws hu.icellmobilsoft.coffee.dto.exception.BaseException
        Run sql select command, and return given column Date value
        Parameters:
        sql - sql command
        columnName - column name
        Returns:
        column Date value
        Throws:
        hu.icellmobilsoft.coffee.dto.exception.BaseException - exception
      • selectRowCount

        public Integer selectRowCount​(String sql)
                               throws hu.icellmobilsoft.coffee.dto.exception.BaseException
        Run sql select command, and return row count
        Parameters:
        sql - sql command
        Returns:
        row count
        Throws:
        hu.icellmobilsoft.coffee.dto.exception.BaseException - exception
      • selectFirstObject

        public <T> T selectFirstObject​(String sql,
                                       hu.icellmobilsoft.coffee.tool.common.FunctionalInterfaces.BaseExceptionFunction<ResultSet,​T> converter)
                                throws hu.icellmobilsoft.coffee.dto.exception.BaseException
        Run sql select command, and return desired result object, converted by given converter

        Example for converter: private T convert(ResultSet rs) { try { T t = new T(); t.setId(rs.getString("X__ID")); t.setName(rs.getString("NAME")); return t; } catch (SQLException e) { return null; } }

        Type Parameters:
        T - type of return object
        Parameters:
        sql - sql command
        converter - converter for desired result object
        Returns:
        converted object
        Throws:
        hu.icellmobilsoft.coffee.dto.exception.BaseException - exception
      • selectAllObjects

        public <T> List<T> selectAllObjects​(String sql,
                                            hu.icellmobilsoft.coffee.tool.common.FunctionalInterfaces.BaseExceptionFunction<ResultSet,​T> converter)
                                     throws hu.icellmobilsoft.coffee.dto.exception.BaseException
        Run sql select command, and return list of desired result objects, converted by given converter

        Example for converter: private T convert(ResultSet rs) { try { T t = new T(); t.setId(rs.getString("X__ID")); t.setName(rs.getString("NAME")); return t; } catch (SQLException e) { return null; } }

        Type Parameters:
        T - type of return objects
        Parameters:
        sql - sql command
        converter - converter for desired result objects
        Returns:
        list of converted objects
        Throws:
        hu.icellmobilsoft.coffee.dto.exception.BaseException - exception
      • setJdbcConnection

        public void setJdbcConnection​(JDBCConnection jdbcConnection)