public abstract class Dao extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected static org.apache.log4j.Logger |
logger |
static String |
TABLE_NAME_PREFIX
Prefix of database table identifiers (database).
|
Constructor and Description |
---|
Dao() |
Modifier and Type | Method and Description |
---|---|
protected static int |
boolToSmallint(boolean value)
Convert boolean value to int
|
protected VirtuosoConnectionWrapper |
createVirtuosoConnectionWrapper(EnumDatabaseInstance dbInstance)
Creates a
VirtuosoConnectionWrapper for the given database instance. |
protected void |
executeInTransaction(CodeSnippet code)
Executes the given code in a Spring transaction.
|
protected DaoLookupFactory |
getLookupFactory()
Returns dao factory instance.
|
protected <E> List<E> |
jdbcQuery(String sql,
Object[] args,
org.springframework.jdbc.core.RowMapper<E> rowMapper) |
protected <E> List<E> |
jdbcQuery(String sql,
org.springframework.jdbc.core.RowMapper<E> rowMapper) |
protected int |
jdbcQueryForInt(String sql) |
protected int |
jdbcQueryForInt(String sql,
Object... args) |
protected int |
jdbcQueryForInt(String sql,
Object[] args,
EnumDatabaseInstance dbInstance) |
protected <E> List<E> |
jdbcQueryForList(String sql,
Class<E> elementType) |
<E> E |
jdbcQueryForObject(String sql,
Object[] args,
Class<E> requiredType) |
protected <E> E |
jdbcQueryForObject(String sql,
Object[] args,
org.springframework.jdbc.core.RowMapper<E> rowMapper) |
protected <E> E |
jdbcQueryForObject(String sql,
Object[] args,
org.springframework.jdbc.core.RowMapper<E> rowMapper,
EnumDatabaseInstance dbInstance) |
protected <E> E |
jdbcQueryForObject(String sql,
org.springframework.jdbc.core.RowMapper<E> rowMapper) |
protected int |
jdbcUpdate(String sql) |
protected int |
jdbcUpdate(String sql,
Object... args) |
protected int |
jdbcUpdate(String sql,
Object[] args,
EnumDatabaseInstance dbInstance) |
void |
setDaoLookupFactory(DaoLookupFactory lookupFactory) |
public static final String TABLE_NAME_PREFIX
protected static org.apache.log4j.Logger logger
public void setDaoLookupFactory(DaoLookupFactory lookupFactory)
lookupFactory
- protected static int boolToSmallint(boolean value)
value
- protected <E> List<E> jdbcQuery(String sql, org.springframework.jdbc.core.RowMapper<E> rowMapper) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessException
JdbcTemplate.query(String, RowMapper)
protected <E> List<E> jdbcQuery(String sql, Object[] args, org.springframework.jdbc.core.RowMapper<E> rowMapper) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessException
JdbcTemplate.query(String, Object[], RowMapper)
protected <E> E jdbcQueryForObject(String sql, org.springframework.jdbc.core.RowMapper<E> rowMapper) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessException
JdbcTemplate.queryForObject(String, RowMapper)
protected <E> E jdbcQueryForObject(String sql, Object[] args, org.springframework.jdbc.core.RowMapper<E> rowMapper) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessException
JdbcTemplate.queryForObject(String, Object[], RowMapper)
public <E> E jdbcQueryForObject(String sql, Object[] args, Class<E> requiredType) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessException
JdbcTemplate.queryForObject(String, Object[], Class)
protected <E> E jdbcQueryForObject(String sql, Object[] args, org.springframework.jdbc.core.RowMapper<E> rowMapper, EnumDatabaseInstance dbInstance) throws org.springframework.dao.DataAccessException
dbInstance
- the database instance to execute the query onorg.springframework.dao.DataAccessException
JdbcTemplate#jdbcQueryForObject(String, Object[], RowMapper)
protected <E> List<E> jdbcQueryForList(String sql, Class<E> elementType) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessException
JdbcTemplate.queryForList(String, Class)
protected int jdbcQueryForInt(String sql) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessException
JdbcTemplate.queryForInt(String)
protected int jdbcQueryForInt(String sql, Object... args) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessException
JdbcTemplate.queryForInt(String, Object...)
protected int jdbcQueryForInt(String sql, Object[] args, EnumDatabaseInstance dbInstance) throws org.springframework.dao.DataAccessException
dbInstance
- the database instance to execute the query onorg.springframework.dao.DataAccessException
JdbcTemplate.queryForInt(String, Object[])
protected int jdbcUpdate(String sql) throws Exception
Exception
JdbcTemplate.update(String)
protected int jdbcUpdate(String sql, Object... args) throws Exception
Exception
JdbcTemplate.update(String, Object...)
protected int jdbcUpdate(String sql, Object[] args, EnumDatabaseInstance dbInstance) throws Exception
dbInstance
- the database instance to execute the query onException
JdbcTemplate.update(String, Object[])
protected void executeInTransaction(CodeSnippet code) throws Exception
RuntimeException
and rollbacks on exception in code.code
- The code to execute in a transactionException
- errorprotected DaoLookupFactory getLookupFactory()
protected VirtuosoConnectionWrapper createVirtuosoConnectionWrapper(EnumDatabaseInstance dbInstance) throws ConnectionException
VirtuosoConnectionWrapper
for the given database instance.dbInstance
- database instance to connect to.ConnectionException
Copyright © 2013. All Rights Reserved.