本文整理了Java中io.ebean.Query.setPersistenceContextScope
方法的一些代码示例,展示了Query.setPersistenceContextScope
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setPersistenceContextScope
方法的具体详情如下:
包路径:io.ebean.Query
类名称:Query
方法名:setPersistenceContextScope
[英]Specify the PersistenceContextScope to use for this query.
When this is not set the 'default' configured on io.ebean.config.ServerConfig#setPersistenceContextScope(PersistenceContextScope)is used - this value defaults to PersistenceContextScope#TRANSACTION.
Note that the same persistence Context is used for subsequent lazy loading and query join queries.
Note that #findEach uses a 'per object graph' PersistenceContext so this scope is ignored for queries executed as #findIterate, #findEach, #findEachWhile.
[中]指定用于此查询的PersistenceContextScope。
如果未设置,则为io上配置的“默认值”。埃宾。配置。使用ServerConfig#setPersistenceContextScope(PersistenceContextScope)-此值默认为PersistenceContextScope#事务。
请注意,相同的持久性上下文用于后续的延迟加载和查询连接查询。
请注意,#findEach使用“每对象图”PersistenceContext,因此对于作为#findIterate、#findEach、#findEachWhile执行的查询,此范围被忽略。
代码示例来源:origin: ebean-orm/ebean
/**
* Optimise the draft query fetching any draftable element relationships.
*/
public void draftQueryOptimise(Query<T> query) {
// use per query PersistenceContext to ensure fresh beans loaded
query.setPersistenceContextScope(PersistenceContextScope.QUERY);
draftHelp.draftQueryOptimise(query);
}
代码示例来源:origin: org.actframework/act-ebean
@Override
public EbeanQuery<MODEL_TYPE> setPersistenceContextScope(PersistenceContextScope scope) {
q.setPersistenceContextScope(scope);
qReadOnly.setPersistenceContextScope(scope);
return this;
}
代码示例来源:origin: org.actframework/act-ebean2
@Override
public EbeanQuery<MODEL_TYPE> setPersistenceContextScope(PersistenceContextScope scope) {
q.setPersistenceContextScope(scope);
return this;
}
代码示例来源:origin: io.ebean/ebean-querybean
/**
* Specify the PersistenceContextScope to use for this query.
* <p>
* When this is not set the 'default' configured on {@link io.ebean.config.ServerConfig#setPersistenceContextScope(PersistenceContextScope)}
* is used - this value defaults to {@link io.ebean.PersistenceContextScope#TRANSACTION}.
* <p>
* Note that the same persistence Context is used for subsequent lazy loading and query join queries.
* <p>
* Note that #findEach uses a 'per object graph' PersistenceContext so this scope is ignored for
* queries executed as #findIterate, #findEach, #findEachWhile.
*
* @param scope The scope to use for this query and subsequent lazy loading.
*/
public R setPersistenceContextScope(PersistenceContextScope scope) {
query.setPersistenceContextScope(scope);
return root;
}
代码示例来源:origin: ebean-orm/ebean
/**
* Fetch the outline bean with associated one and associated many beans loaded with Id values only.
* <p>
* We use the Id values to determine what are inserts, updates and deletes as part of the merge.
*/
private EntityBean fetchOutline(Set<String> paths) {
Query<?> query = server.find(desc.getBeanType());
query.setBeanCacheMode(CacheMode.OFF);
query.setPersistenceContextScope(PersistenceContextScope.QUERY);
query.setId(desc.getId(bean));
query.select(desc.getIdProperty().getName());
for (String path : paths) {
MergeNode node = buildNode(path);
node.addSelectId(query);
}
return (EntityBean) server.findOne(query, transaction);
}
代码示例来源:origin: io.ebean/ebean
/**
* Optimise the draft query fetching any draftable element relationships.
*/
public void draftQueryOptimise(Query<T> query) {
// use per query PersistenceContext to ensure fresh beans loaded
query.setPersistenceContextScope(PersistenceContextScope.QUERY);
draftHelp.draftQueryOptimise(query);
}
代码示例来源:origin: icode/ameba
/**
* {@inheritDoc}
*/
public Query<T> setPersistenceContextScope(PersistenceContextScope persistenceContextScope) {
return query().setPersistenceContextScope(persistenceContextScope);
}
代码示例来源:origin: io.ebean/ebean
/**
* Fetch the outline bean with associated one and associated many beans loaded with Id values only.
* <p>
* We use the Id values to determine what are inserts, updates and deletes as part of the merge.
*/
private EntityBean fetchOutline(Set<String> paths) {
Query<?> query = server.find(desc.getBeanType());
query.setBeanCacheMode(CacheMode.OFF);
query.setPersistenceContextScope(PersistenceContextScope.QUERY);
query.setId(desc.getId(bean));
query.select(desc.getIdProperty().getName());
for (String path : paths) {
MergeNode node = buildNode(path);
node.addSelectId(query);
}
return (EntityBean) server.findOne(query, transaction);
}
内容来源于网络,如有侵权,请联系作者删除!