本文整理匯總了Java中com.j256.ormlite.stmt.Where.in方法的典型用法代碼示例。如果您正苦於以下問題:Java Where.in方法的具體用法?Java Where.in怎麽用?Java Where.in使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.j256.ormlite.stmt.Where
的用法示例。
在下文中一共展示了Where.in方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getLastDialogNotificationByDialogId
import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
public DialogNotification getLastDialogNotificationByDialogId(List<Long> dialogOccupantsList) {
DialogNotification dialogNotification = null;
try {
QueryBuilder<DialogNotification, Long> queryBuilder = dao.queryBuilder();
Where<DialogNotification, Long> where = queryBuilder.where();
where.in(DialogOccupant.Column.ID, dialogOccupantsList);
queryBuilder.orderBy(DialogNotification.Column.CREATED_DATE, false);
PreparedQuery<DialogNotification> preparedQuery = queryBuilder.prepare();
dialogNotification = dao.queryForFirst(preparedQuery);
} catch (SQLException e) {
ErrorUtils.logError(e);
}
return dialogNotification;
}
示例2: getLastMessageByDialogId
import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
public Message getLastMessageByDialogId(List<Long> dialogOccupantsList) {
Message message = null;
try {
QueryBuilder<Message, Long> queryBuilder = dao.queryBuilder();
Where<Message, Long> where = queryBuilder.where();
where.in(DialogOccupant.Column.ID, dialogOccupantsList);
queryBuilder.orderBy(Message.Column.CREATED_DATE, false);
PreparedQuery<Message> preparedQuery = queryBuilder.prepare();
message = dao.queryForFirst(preparedQuery);
} catch (SQLException e) {
ErrorUtils.logError(e);
}
return message;
}
示例3: getQueryIdsForOrg
import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
protected void getQueryIdsForOrg(MitroRequestContext context, int orgId, Set<Integer> userIds, Set<Integer> secretIds, Set<Integer> groupIds)
throws MitroServletException, SQLException {
// TODO: We need to create an API for orgs and clean this up.
@SuppressWarnings("deprecation")
AuthenticatedDB userDb = AuthenticatedDB.deprecatedNew(context.manager, context.requestor);
if (!userDb.isOrganizationAdmin(orgId)) {
throw new MitroServletException("Not org or no access");
}
RPC.GetOrganizationStateResponse out = GetOrganizationState.doOperation(context, orgId);
userIds.clear();
// TODO: change GetOrganizationState query to return the user id column.
if (!out.members.isEmpty()) {
QueryBuilder<DBIdentity, Integer> query = context.manager.identityDao.queryBuilder();
query.selectColumns(DBIdentity.ID_NAME);
Where<DBIdentity, Integer> where = query.where();
where.in(DBIdentity.NAME_FIELD_NAME, Manager.makeSelectArgsFromList(out.members));
for (DBIdentity identity : query.query()) {
userIds.add(identity.getId());
}
}
secretIds.clear();
secretIds.addAll(out.orgSecretsToPath.keySet());
secretIds.addAll(out.orphanedSecretsToPath.keySet());
groupIds.clear();
groupIds.addAll(out.groups.keySet());
}
示例4: testTwoResultsInSubQuery
import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
@Test(expected = SQLException.class)
public void testTwoResultsInSubQuery() throws Exception {
BaseDaoImpl<ForeignFoo, Integer> foreignDao =
new BaseDaoImpl<ForeignFoo, Integer>(connectionSource, ForeignFoo.class) {
};
QueryBuilder<ForeignFoo, Integer> qbInner = foreignDao.queryBuilder();
qbInner.selectColumns(ID_COLUMN_NAME);
QueryBuilder<ForeignFoo, Integer> qbOuter = foreignDao.queryBuilder();
qbInner.selectColumns(FOREIGN_COLUMN_NAME);
Where<ForeignFoo, Integer> where = qbOuter.where();
where.in(ID_COLUMN_NAME, qbInner);
where.prepare();
}
示例5: testResultColumnNoMatchWhere
import com.j256.ormlite.stmt.Where; //導入方法依賴的package包/類
@Test(expected = SQLException.class)
public void testResultColumnNoMatchWhere() throws Exception {
BaseDaoImpl<ForeignFoo, Integer> foreignDao =
new BaseDaoImpl<ForeignFoo, Integer>(connectionSource, ForeignFoo.class) {
};
QueryBuilder<ForeignFoo, Integer> qbInner = foreignDao.queryBuilder();
qbInner.selectColumns(STRING_COLUMN_NAME);
QueryBuilder<ForeignFoo, Integer> qbOuter = foreignDao.queryBuilder();
Where<ForeignFoo, Integer> where = qbOuter.where();
where.in(ID_COLUMN_NAME, qbInner);
where.prepare();
}