Class AbstractDAO
- java.lang.Object
-
- org.silverpeas.core.persistence.jdbc.AbstractDAO
-
- Direct Known Subclasses:
NodeDAO
,PublicationDAO
public abstract class AbstractDAO extends Object
- Author:
- mmoquillon
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractDAO()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static Date
asDate(String dateAsSqlString, String nullValue)
Decodes the specified String representation of a date to aDate
object.protected static void
setDateParameter(PreparedStatement statement, int idx, Date date, String defaultDate)
Sets the date parameter to the specified prepared statement.protected static void
setStringParameter(PreparedStatement statement, int idx, String value, String defaultValue)
Sets the text parameter to the specified prepared statement.
-
-
-
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 statementidx
- the index of the parameter to setdate
- the date to setdefaultDate
- 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 statementidx
- the index of the parameter to setvalue
- the text to setdefaultValue
- 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 aDate
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.
-
-