本文整理了Java中net.java.ao.Query.toSQL
方法的一些代码示例,展示了Query.toSQL
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.toSQL
方法的具体详情如下:
包路径:net.java.ao.Query
类名称:Query
方法名:toSQL
暂无
代码示例来源:origin: net.java.dev.activeobjects/activeobjects-core
/**
* Counts all entities of the specified type matching the given {@link Query} instance. The SQL runs as a
* <code>SELECT COUNT(*)</code> to ensure maximum performance.
*
* @param type The type of the entities which should be counted.
* @param query The {@link Query} instance used to determine the result set which will be counted.
* @return The number of entities of the given type which match the specified query.
*/
public <K> int count(Class<? extends RawEntity<K>> type, Query query) throws SQLException {
EntityInfo entityInfo = resolveEntityInfo(type);
Connection connection = null;
PreparedStatement stmt = null;
ResultSet res = null;
try {
connection = provider.getConnection();
final String sql = query.toSQL(entityInfo, provider, getTableNameConverter(), true);
stmt = provider.preparedStatement(connection, sql);
provider.setQueryStatementProperties(stmt, query);
query.setParameters(this, stmt);
res = stmt.executeQuery();
return res.next() ? res.getInt(1) : -1;
} finally {
closeQuietly(res);
closeQuietly(stmt);
closeQuietly(connection);
}
}
代码示例来源:origin: net.java.dev.activeobjects/activeobjects
/**
* Counts all entities of the specified type matching the given {@link Query} instance. The SQL runs as a
* <code>SELECT COUNT(*)</code> to ensure maximum performance.
*
* @param type The type of the entities which should be counted.
* @param query The {@link Query} instance used to determine the result set which will be counted.
* @return The number of entities of the given type which match the specified query.
*/
public <K> int count(Class<? extends RawEntity<K>> type, Query query) throws SQLException {
EntityInfo entityInfo = resolveEntityInfo(type);
Connection connection = null;
PreparedStatement stmt = null;
ResultSet res = null;
try {
connection = provider.getConnection();
final String sql = query.toSQL(entityInfo, provider, getTableNameConverter(), true);
stmt = provider.preparedStatement(connection, sql);
provider.setQueryStatementProperties(stmt, query);
query.setParameters(this, stmt);
res = stmt.executeQuery();
return res.next() ? res.getInt(1) : -1;
} finally {
closeQuietly(res);
closeQuietly(stmt);
closeQuietly(connection);
}
}
代码示例来源:origin: net.java.dev.activeobjects/activeobjects
try {
conn = provider.getConnection();
final String sql = query.toSQL(entityInfo, provider, getTableNameConverter(), false);
代码示例来源:origin: net.java.dev.activeobjects/activeobjects-core
try {
conn = provider.getConnection();
final String sql = query.toSQL(entityInfo, provider, getTableNameConverter(), false);
代码示例来源:origin: net.java.dev.activeobjects/activeobjects
try {
conn = provider.getConnection();
final String sql = query.toSQL(entityInfo, provider, getTableNameConverter(), false);
代码示例来源:origin: net.java.dev.activeobjects/activeobjects-core
try {
conn = provider.getConnection();
final String sql = query.toSQL(entityInfo, provider, getTableNameConverter(), false);
内容来源于网络,如有侵权,请联系作者删除!