com.onewebsql.dao
Interface DAO<T>

Type Parameters:
T - the type of objects this DAO is handling
All Known Implementing Classes:
BaseDAO

public interface DAO<T>

An interface of DAO objects.


Method Summary
 Integer delete(DeleteQuery deleteStatement)
          Executes the specified DELETE statement.
 DaoMonitor getDaoMonitor()
          Returns the DAO monitor used by this DAO object.
 DataSource getDataSource()
          Returns the data source used by this DAO object.
 DBAdapter getDbAdapter()
          Returns the database adapter used by this DAO object.
 Long getNextId(TableExpression tableExpression)
          Returns the next row id for the specified table expression.
 Class<T> getPojoClass()
          Returns the class of POJO objects this DAO is handling.
 RowHandler<T> getRowHandler()
          Returns the RowHandler object this DAO is using while generating POJO objects.
 DaoSchema getSchema()
          Returns the schema name used by this DAO object.
 TableExpression getTableExpression()
          Returns the table expression which represents this DAO's table.
 Integer insert(InsertQuery insertStatement)
          Executes the specified INSERT statement.
<U> U
selectObject(SelectQuery query, RowHandler<U> rowHandler)
          Executes the specified SELECT query and returns the only object (generated by the specified RowHandler object) from the query result.
<U> SelectObjectListResult<U>
selectObjectList(SelectQuery query, RowHandler<U> rowHandler)
          Executes the specified SELECT query and returns a list of objects generated from query results by the specified RowHandler object.
 void setDaoMonitor(DaoMonitor daoMonitor)
          Sets the monitor used by this DAO object.
 Integer update(UpdateQuery updateStatement)
          Executes the specified UPDATE statement.
 

Method Detail

getTableExpression

TableExpression getTableExpression()
Returns the table expression which represents this DAO's table.

Returns:
the table expression which represents this DAO's table.

getPojoClass

Class<T> getPojoClass()
Returns the class of POJO objects this DAO is handling.

Returns:
the class of POJO objects this DAO is handling.

getRowHandler

RowHandler<T> getRowHandler()
Returns the RowHandler object this DAO is using while generating POJO objects.

Returns:
the RowHandler object this DAO is using while generating POJO objects.

selectObjectList

<U> SelectObjectListResult<U> selectObjectList(SelectQuery query,
                                               RowHandler<U> rowHandler)
Executes the specified SELECT query and returns a list of objects generated from query results by the specified RowHandler object.

Parameters:
query - SQL query
rowHandler - object generating Java objects from SQL result
Returns:
an object containing query result

selectObject

<U> U selectObject(SelectQuery query,
                   RowHandler<U> rowHandler)
Executes the specified SELECT query and returns the only object (generated by the specified RowHandler object) from the query result. If the query returns more than 1 row an exception is thrown.

Parameters:
query - SQL query.
rowHandler - object generating Java objects from SQL result
Returns:
an object generated by the RowHandler from the first (the only) row returned by the SQL query
Throws:
QueryFetchException - if the SQL query returns more than 1 row

getNextId

Long getNextId(TableExpression tableExpression)
Returns the next row id for the specified table expression.

Parameters:
tableExpression - table expression
Returns:
the next row id

insert

Integer insert(InsertQuery insertStatement)
Executes the specified INSERT statement. The method logs the statement in the right way.

Parameters:
insertStatement - INSERT statement to execute.
Returns:
number of rows which have been modified by the statement.

update

Integer update(UpdateQuery updateStatement)
Executes the specified UPDATE statement. The method logs the statement in the right way.

Parameters:
updateStatement - UPDATE statement to execute.
Returns:
number of rows which have been modified by the statement.

delete

Integer delete(DeleteQuery deleteStatement)
Executes the specified DELETE statement. The method logs the statement in the right way.

Parameters:
deleteStatement - DELETE statement to execute.
Returns:
number of rows which have been modified by the statement.

getDataSource

DataSource getDataSource()
Returns the data source used by this DAO object.

Returns:
the data source used by this DAO object.

getDaoMonitor

DaoMonitor getDaoMonitor()
Returns the DAO monitor used by this DAO object.

Returns:
the DAO monitor used by this DAO object.

setDaoMonitor

void setDaoMonitor(DaoMonitor daoMonitor)
Sets the monitor used by this DAO object.

Parameters:
daoMonitor - the monitor used by this DAO object.

getDbAdapter

DBAdapter getDbAdapter()
Returns the database adapter used by this DAO object.

Returns:
the database adapter used by this DAO object.

getSchema

DaoSchema getSchema()
Returns the schema name used by this DAO object.

Returns:
the schema name used by this DAO object.


Copyright © 2011-2013 e-point SA. All Rights Reserved.