Class AbstractDAO

    • Constructor Detail

      • AbstractDAO

        protected AbstractDAO()
    • Method Detail

      • setDateParameter

        protected static void setDateParameter​(PreparedStatement statement,
                                               int idx,
                                               Date date,
                                               String defaultDate)
                                        throws SQLException
        Sets the date parameter to the specified prepared statement.
        Parameters:
        statement - the prepared statement
        idx - the index of the parameter to set
        date - the date to set
        defaultDate - the date to set by default if the date above is null
        Throws:
        SQLException - if an error occurs.
      • setStringParameter

        protected static void setStringParameter​(PreparedStatement statement,
                                                 int idx,
                                                 String value,
                                                 String defaultValue)
                                          throws SQLException
        Sets the text parameter to the specified prepared statement.
        Parameters:
        statement - the prepared statement
        idx - the index of the parameter to set
        value - the text to set
        defaultValue - the text to set by default if the above value is null.
        Throws:
        SQLException - if an error occurs.
      • asDate

        protected static Date asDate​(String dateAsSqlString,
                                     String nullValue)
                              throws ParseException
        Decodes the specified String representation of a date to a Date object.
        Parameters:
        dateAsSqlString - the textual representation of an SQL date.
        nullValue - the String representation of a null date. If the value above matches this representation, then null is returned.
        Returns:
        the decoded date.
        Throws:
        ParseException - if the text doesn't represent a date as expected.