本文整理匯總了Java中com.j256.ormlite.stmt.Where.isNull方法的典型用法代碼示例。如果您正苦於以下問題:Java Where.isNull方法的具體用法?Java Where.isNull怎麽用?Java Where.isNull使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.j256.ormlite.stmt.Where
的用法示例。
在下文中一共展示了Where.isNull方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: byColumns
import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
public static Assignment byColumns(Map<String, Object> constraints) {
try {
Where<Assignment, Integer> where = Assignment.dao.queryBuilder().where();
Boolean first = true;
for (Map.Entry<String, Object> constraint: constraints.entrySet()) {
if (!first) {
where = where.and();
}
if (constraint.getValue() == null) {
where = where.isNull(constraint.getKey());
} else {
where = where.eq(constraint.getKey(), constraint.getValue());
}
first = false;
}
return Assignment.dao.queryForFirst(where.prepare());
} catch (SQLException e) {
e.printStackTrace();
return null;
}
}
示例2: byColumns
import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
public static LTIConsumer byColumns(Map<String, Object> constraints) {
try {
Where<LTIConsumer, Integer> where = LTIConsumer.dao.queryBuilder().where();
Boolean first = true;
for (Map.Entry<String, Object> constraint: constraints.entrySet()) {
if (!first) {
where = where.and();
}
if (constraint.getValue() == null) {
where = where.isNull(constraint.getKey());
} else {
where = where.eq(constraint.getKey(), constraint.getValue());
}
first = false;
}
return LTIConsumer.dao.queryForFirst(where.prepare());
} catch (SQLException e) {
e.printStackTrace();
return null;
}
}
示例3: byColumns
import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
public static User byColumns(Map<String, Object> constraints) {
try {
Where<User, Integer> where = User.dao.queryBuilder().where();
Boolean first = true;
for (Map.Entry<String, Object> constraint: constraints.entrySet()) {
if (!first) {
where = where.and();
}
if (constraint.getValue() == null) {
where = where.isNull(constraint.getKey());
} else {
where = where.eq(constraint.getKey(), constraint.getValue());
}
first = false;
}
return User.dao.queryForFirst(where.prepare());
} catch (SQLException e) {
e.printStackTrace();
return null;
}
}
示例4: fetch
import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
/**
* Parametrized fetch Gets all BusinessObjects matching the parameters
*
* @param params Map of column = value, used in Where clause
* @param limit the maximum number of returned results. Values below 0 means no limit
*
* @return a list of all BusinessObjects matching the values provided by params
*
* @throws SQLException
*/
@Override
public List<BusinessObjectType> fetch(Map<String, Object> params, int limit) throws SQLException
{
this.beforeFetch();
List<BusinessObjectType> bos = null;
if (params.containsValue(null) || limit >= 0) {
QueryBuilder<BusinessObjectType, Integer> queryBuilder = dao.queryBuilder();
Where<BusinessObjectType, Integer> where = queryBuilder.where();
Iterator<Map.Entry<String, Object>> entryIterator = params.entrySet().iterator();
while (entryIterator.hasNext()) {
Map.Entry<String, Object> entry = entryIterator.next();
if (entry.getValue() != null) {
where.eq(entry.getKey(), entry.getValue());
} else {
where.isNull(entry.getKey());
}
if (entryIterator.hasNext()) {
where = where.and();
}
}
queryBuilder.setWhere(where);
if (limit >= 0) {
queryBuilder.limit((long) limit);
}
bos = dao.query(queryBuilder.prepare());
} else {
bos = dao.queryForFieldValues(params);
}
for (BusinessObjectType bo : bos) {
this.afterFetch(bo);
}
return bos;
}