本文整理汇总了Java中com.mysema.query.sql.SQLQuery.list方法的典型用法代码示例。如果您正苦于以下问题:Java SQLQuery.list方法的具体用法?Java SQLQuery.list怎么用?Java SQLQuery.list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mysema.query.sql.SQLQuery
的用法示例。
在下文中一共展示了SQLQuery.list方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAllFast
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
/**
* Uses the full bean, but optimized SQL
*
* @param offset
* @param limit
* @return
* @throws Exception
*/
private List<WalkerEntityref100> getAllFast(long offset, long limit)
throws Exception {
Connection conn = getConnection();
QWalkerEntityref100 t = new QWalkerEntityref100("t");
SQLQuery sq = from(conn, t);
/*
* Use the built-in Id to grab a range. Here we are assuming something
* about the IDs, so be careful, this code is not portable.
*
* We also skip over some list of idTypes, again this is very
* customer/data specific.
*/
sq.where(t.entityrefId.between(offset, limit).and(
t.idtypeId.notIn(idTypeDAO.getSkipTypes())));
/*
* Note that we are not sorting the elements here, in order to speed
* things up.
*/
List<WalkerEntityref100> results = sq.list(t);
conn.close();
return results;
}
示例2: findByQuery
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
/**
* TODO: This is the same as getTransactions, so migrate usage to this
* method.
*/
@Override
public List<WalkerTransactionPair100> findByQuery(EventQuery q)
throws Exception {
List<WalkerTransactionPair100> results = new ArrayList<WalkerTransactionPair100>();
QWalkerTransactionPair100 t = new QWalkerTransactionPair100("t");
Connection conn;
conn = getConnection();
if (q.getIdList().isEmpty()) {
logger.warn("query has no ids:" + q);
}
SQLQuery sq = buildQuery(q, t, conn); // MFM
sq = setOffsetAndLimit(q, sq);
logger.debug(q.toString());
if (sq != null) {
results = sq.list(t);
}
conn.close();
if (results != null) {
logger.debug("Returning " + results.size() + " entries");
}
return results;
}
示例3: getAll
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
/**
* Essentially the same as getTransactions, but only looks at offset and max
* results as parameters
*/
@Override
public List<WalkerTransactionPair100> getAll(long offset, long maxResults)
throws Exception {
QWalkerTransactionPair100 t = new QWalkerTransactionPair100("t");
Connection conn;
conn = getConnection();
SQLQuery sq = from(conn, t);
sq = setOffsetAndLimit(offset, maxResults, sq);
List<WalkerTransactionPair100> results = new ArrayList<WalkerTransactionPair100>();
if (sq != null) {
results = sq.list(t);
}
conn.close();
if (results != null) {
logger.debug("Returning " + results.size() + " entries");
}
return results;
}
示例4: findByQuery
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Override
public List<WalkerIdentifierType100> findByQuery(StringQuery q)
throws Exception {
List<WalkerIdentifierType100> results = new ArrayList<WalkerIdentifierType100>();
QWalkerIdentifierType100 t = new QWalkerIdentifierType100("t");
Connection conn;
conn = getConnection();
SQLQuery sq = buildQuery(q, t, conn);
sq = setOffsetAndLimit(q, sq);
if (sq != null) {
sq = sq.orderBy(t.idtypeId.asc());
results = sq.list(t);
}
conn.close();
if (results != null) {
logger.debug("Returning " + results.size() + " entries");
}
return results;
}
示例5: getAll
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Override
public List<WalkerIdentifierType100> getAll(long offset, long maxResults)
throws Exception {
List<WalkerIdentifierType100> results;
QWalkerIdentifierType100 t = new QWalkerIdentifierType100("t");
Connection conn;
conn = getConnection();
SQLQuery sq = from(conn, t);
results = sq.list(t);
conn.close();
if (results != null) {
logger.debug("Returning " + results.size() + " entries");
}
return results;
}
示例6: getAllFast
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
/**
* Uses the full bean, but optimized SQL
*
* @param offset
* @param limit
* @return
* @throws Exception
*/
private List<WalkerEntityref100> getAllFast(long offset, long limit)
throws Exception {
Connection conn = getConnection();
QWalkerEntityref100 t = new QWalkerEntityref100("t");
SQLQuery sq = from(conn, t);
/*
* XXX: Note that we are treating offset and limit differently than
* usual. When using it in a between statement, we need to use
* limit+offset
*/
sq = sq.where(t.entityrefId.between(offset, limit + offset).and(
t.idtypeId.notIn(idTypeDAO.getSkipTypes())));
/*
* Note that we are not sorting the elements here, in order to speed
* things up.
*/
logger.debug("Query: " + sq.toString());
List<WalkerEntityref100> results = sq.list(t);
conn.close();
return results;
}
示例7: getAccounts
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
/**
* @param q
* @return
* @throws Exception
*/
public ArrayList<G_Link> getAccounts(EventQuery q) throws Exception {
ArrayList<G_Link> results = new ArrayList<G_Link>();
QWalkerTransactionPair100 t = new QWalkerTransactionPair100("t");
BooleanBuilder builder = new BooleanBuilder();
for (String acno : q.getIdList()) {
builder.or(t.receiverId.eq(FastNumberUtils.parseLongWithCheck(acno)));
builder.or(t.senderId.eq(FastNumberUtils.parseLongWithCheck(acno)));
}
Connection conn = getConnection();
SQLQuery sq = from(conn, t).where(builder).orderBy(t.receiverId.asc());
sq = setOffsetAndLimit(q.getFirstResult(), q.getMaxResult(), sq);
List<Tuple> list = new ArrayList<Tuple>();
if (sq != null) {
list = sq.list(t.receiverId, t.senderId);
}
for (Tuple tuple : list) {
// TODO: fill in more fields
//G_Link link = new G_Link(tuple.get(0, String.class), tuple.get(1, String.class), true, null, null, null, null);
G_Link link = new LinkHelper(
G_LinkTag.COMMUNICATION, // G_LinkTag tag
tuple.get(t.senderId).toString(), // String source
tuple.get(t.receiverId).toString(), // String target
null // List<G_Property> props
);
results.add(link);
}
logger.debug("Returning " + results.size() + " entries");
return results;
}
示例8: getAllTuples
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
private List<Tuple> getAllTuples(long offset, long limit) throws Exception {
Connection conn = getConnection();
QWalkerEntityref100 t = new QWalkerEntityref100("t");
SQLQuery sq = from(conn, t);
/*
* Use the built-in Id to grab a range. Here we are assuming that the
* id's were assigned in a continuous fashion , so be careful, this code
* is not portable.
*
* We also skip over some list of idTypes, again this is very
* customer/data specific.
*/
/*
* XXX: Note that we are treating offset and limit differently than
* usual. When using it in a between statement, we need to use
* limit+offset
*/
sq = sq.where(t.entityrefId.between(offset, limit + offset));
List<Integer> st = idTypeDAO.getSkipTypes();
if (st != null && st.size() > 0) {
logger.debug("Adding constraint to filter skipped types");
sq.where(t.idtypeId.notIn(st));
} else {
logger.debug("No types to skip were specified.");
}
/*
* Note that we are not sorting the elements here, in order to speed
* things up.
*/
logger.debug("Query: " + sq.toString());
List<Tuple> results = sq.list(t.accountnumber, t.accountnumber,
t.identifier, t.idtypeId);
conn.close();
return results;
}
示例9: search
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Transactional
@Override
public <T> PagedList<T> search(QueryConfigurer commonClause, QueryConfigurer orderByClause, long pageNo,
long pageSz, Predicate<Long> cancelPredicate, final Expression<T> expression) {
Function<SQLQuery, List<T>> searchFunction = new Function<SQLQuery, List<T>>() {
@Override
public List<T> apply(SQLQuery query) {
return query.list(expression);
}
};
return searchMain(commonClause, orderByClause, pageNo, pageSz, cancelPredicate, searchFunction);
}
示例10: getTemplate
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Transactional
@Override
public MailData getTemplate(String templateName) {
SQLQuery querya = queryFactory.from(mt);
querya.where(mt.templateName.eq(templateName));
Tuple templ = querya.singleResult(mt.id, mt.fromAddr, mt.replyToAddr, mt.subject, mt.body);
SQLQuery queryb = queryFactory.from(mtr);
queryb.where(mtr.templateId.eq(templ.get(mt.id)));
List<Tuple> templAddr = queryb.list(mtr.rcptType, mtr.rcptAddr);
List<String> toAddr = new ArrayList<>();
List<String> ccAddr = new ArrayList<>();
List<String> bccAddr = new ArrayList<>();
for (Tuple addr : templAddr) {
RcptType type = RcptType.valueOf(addr.get(mtr.rcptType));
if (type == RcptType.TO) {
toAddr.add(addr.get(mtr.rcptAddr));
}
if (type == RcptType.CC) {
ccAddr.add(addr.get(mtr.rcptAddr));
}
if (type == RcptType.BCC) {
bccAddr.add(addr.get(mtr.rcptAddr));
}
}
MailData template = new MailData();
template.setFromAddr(templ.get(mt.fromAddr));
template.setToAddr(toAddr);
template.setCcAddr(ccAddr);
template.setBccAddr(bccAddr);
template.setReplyToAddr(templ.get(mt.replyToAddr));
template.setSubject(templ.get(mt.subject));
template.setBody(templ.get(mt.body));
return template;
}
示例11: getCodeList
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Transactional(readOnly = true)
@Override
public List<CodeEntry> getCodeList(String codeName) {
SQLQuery query = queryFactory.from(qcm);
query.where(qcm.name.eq(codeName));
query.orderBy(qcm.sortOrder.asc());
return query.list(new QBean<>(CodeEntry.class, qcm.value, qcm.label, qcm.sortOrder));
}
示例12: getDefinition
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Override
public NumberingDefinition getDefinition(String numberName) {
SQLQuery query = createBaseQuery(numberName);
List<NumberingDefinition> list = query.list(new QBean<NumberingDefinition>(NumberingDefinition.class,
nm.template, nm.minValue, nm.maxValue));
return DataAccessUtils.requiredSingleResult(list);
}
示例13: loadAndLock
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Override
public long loadAndLock(String numberName) {
SQLQuery query = createBaseQuery(numberName);
query.forUpdate();
List<Long> list = query.list(nm.currentValue);
return DataAccessUtils.requiredSingleResult(list).longValue();
}
示例14: getCodeList
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
@Transactional(readOnly = true)
@Override
public List<CodeEntry> getCodeList(String codeName) {
SQLQuery query = queryFactory.from(qcm);
query.where(qcm.name.eq(codeName), qcm.deletedFlg.eq(DeletedFlag.NOT_DELETED.code()));
query.orderBy(qcm.sortOrder.asc());
return query.list(new QBean<>(CodeEntry.class, qcm.value, qcm.label, qcm.sortOrder));
}
示例15: executeGetDatasetStatus
import com.mysema.query.sql.SQLQuery; //导入方法依赖的package包/类
private Object executeGetDatasetStatus(GetDatasetStatus query) {
SQLQuery baseQuery = query().from(datasetStatus)
.join(dataset).on(dataset.id.eq(datasetStatus.id));
Expression<DatasetStatusInfo> expression =
new QDatasetStatusInfo(
dataset.identification,
datasetStatus.columnsChanged,
datasetStatus.filterConditionChanged,
datasetStatus.sourceDatasetChanged,
datasetStatus.imported,
Expressions.constant(false),
datasetStatus.sourceDatasetColumnsChanged,
datasetStatus.sourceDatasetRevisionChanged);
String datasourceId = query.getDatasetId();
if(datasourceId == null) {
return new TypedList<>(
DatasetStatusInfo.class,
baseQuery.list(expression));
} else {
return
baseQuery.where(dataset.identification.eq(datasourceId))
.singleResult(expression);
}
}