public interface PersistentObjectDAO<T extends PersistentObject>
Modifier and Type | Method and Description |
---|---|
int |
bulkUpdate(String expression,
Object[] values)
Executes a bulk update as specified by the given expression
|
boolean |
delete(long id)
This method deletes an entity.
|
void |
deleteAll(Collection<T> entities)
Deletes all entries form the database
|
List<T> |
findAll()
Finds all entities in the database
|
List<Long> |
findAllIds()
Finds all entities ids
|
T |
findById(long id)
This method finds an entity by ID.
|
List<Object> |
findByQuery(String query,
Object[] values,
Integer max)
Find everything you want from the DB using the ORM query language
|
List<T> |
findByWhere(String where,
Object[] values,
String order,
Integer max)
Finds all entities by the given expression.
|
List<T> |
findByWhere(String where,
String order,
Integer max)
Finds all entities by the given expression.
|
List<Long> |
findIdsByWhere(String where,
Object[] values,
String order,
Integer max)
Finds all entities ids by the given expression.
|
List<Long> |
findIdsByWhere(String where,
String order,
Integer max)
Finds all entities ids by the given expression.
|
String |
getDbms()
Get the DBMS currently connected( possible values are: mysql, hsqldb, oracle, mssql)
|
void |
initialize(T entity)
Initialises lazy loaded data such as collections
|
int |
jdbcUpdate(String statement)
Executes the given SQL update statement
|
int |
jdbcUpdate(String statement,
Object... args)
Issue a single SQL update operation (such as an insert, update or delete
statement) via a prepared statement, binding the given arguments.
|
List |
query(String sql,
Object[] args,
org.springframework.jdbc.core.RowMapper rowMapper,
Integer maxRows)
Query given SQL to create a prepared statement from SQL and a list of
arguments to bind to the query, mapping each row to a Java object via a
RowMapper.
|
int |
queryForInt(String sql)
Execute a query that results in an int value, given static SQL.
|
List |
queryForList(String sql,
Class elementType)
Execute a query for a result list, given static SQL.
|
List |
queryForList(String sql,
Object[] args,
Class elementType,
Integer maxRows)
Query given SQL to create a prepared statement from SQL and a list of
arguments to bind to the query, expecting a result list.
|
long |
queryForLong(String sql)
Execute a query that results in an long value, given static SQL.
|
org.springframework.jdbc.support.rowset.SqlRowSet |
queryForRowSet(String sql,
Object[] args,
Integer maxRows)
Query given SQL to create a prepared statement from SQL and a list of
arguments to bind to the query, returns a navigable RowSet
|
boolean |
store(T entity)
This method persists the entity object.
|
boolean store(T entity)
entity
- entity to be stored.boolean delete(long id)
id
- ID of the entity which should be deleted.T findById(long id)
doc
- ID of the entity.List<Long> findAllIds()
where
- The where clause expressionList<T> findByWhere(String where, String order, Integer max)
where
- The where clause expressionorder
- The order clause expressionmax
- Maximum results number (optional)List<T> findByWhere(String where, Object[] values, String order, Integer max)
where
- The where clause expression (for positional parameters, please use JPA-style: ?1, ?2 ...)values
- Parameters used in the where expressionorder
- The order clause expressionmax
- Maximum results number (optional)List<Object> findByQuery(String query, Object[] values, Integer max)
query
- The query to execute (for positional parameters, please use JPA-style: ?1, ?2 ...)values
- Array of paramatersmax
- Maximum results number (optional)List<Long> findIdsByWhere(String where, String order, Integer max)
where
- The where clause expressionorder
- The order clause expressionmax
- Maximum results number (optional)List<Long> findIdsByWhere(String where, Object[] values, String order, Integer max)
where
- The where clause expression (for positional parameters, please use JPA-style: ?1, ?2 ...)values
- Parameters used in the where expressionorder
- The order clause expressionmax
- Maximum results number (optional)void initialize(T entity)
entity
- The entity to be initialisedList query(String sql, Object[] args, org.springframework.jdbc.core.RowMapper rowMapper, Integer maxRows)
sql
- SQL query to executeargs
- arguments to bind to the query (leaving it to the
PreparedStatement to guess the corresponding SQL type); may also
contain SqlParameterValue objects which indicate not only the
argument value but also the SQL type and optionally the scalemaxRows
- the new max rows limit; null means there is no limitrowMapper
- object that will map one object per roworg.springframework.jdbc.support.rowset.SqlRowSet queryForRowSet(String sql, Object[] args, Integer maxRows)
sql
- SQL query to executeargs
- arguments to bind to the query (leaving it to the
PreparedStatement to guess the corresponding SQL type); may also
contain SqlParameterValue objects which indicate not only the
argument value but also the SQL type and optionally the scalemaxRows
- the new max rows limit; null means there is no limitList queryForList(String sql, Object[] args, Class elementType, Integer maxRows)
sql
- SQL query to executeelementType
- the required type of element in the result list (for
example, Integer.class)args
- arguments to bind to the query (leaving it to the
PreparedStatement to guess the corresponding SQL type); may also
contain SqlParameterValue objects which indicate not only the
argument value but also the SQL type and optionally the scaleList queryForList(String sql, Class elementType)
sql
- SQL query to executeelementType
- the required type of element in the result list (for
example, Integer.class)int queryForInt(String sql)
sql
- SQL query to executelong queryForLong(String sql)
sql
- SQL query to executevoid deleteAll(Collection<T> entities)
entities
- The entities to be deletedint bulkUpdate(String expression, Object[] values)
int jdbcUpdate(String statement)
int jdbcUpdate(String statement, Object... args)
statement
- SQL containing bind parametersargs
- arguments to bind to the query (leaving it to the
PreparedStatement to guess the corresponding SQL type); may also
contain SqlParameterValue objects which indicate not only the
argument value but also the SQL type and optionally the scaleString getDbms()
Copyright © 2008-2014 Logical Objects. All Rights Reserved.