本文整理了Java中org.apache.openjpa.persistence.QueryImpl.popQueryFetchPlan
方法的一些代码示例,展示了QueryImpl.popQueryFetchPlan
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueryImpl.popQueryFetchPlan
方法的具体详情如下:
包路径:org.apache.openjpa.persistence.QueryImpl
类名称:QueryImpl
方法名:popQueryFetchPlan
暂无
代码示例来源:origin: org.apache.openejb.patch/openjpa
public List getResultList() {
_em.assertNotCloseInvoked();
boolean queryFetchPlanUsed = pushQueryFetchPlan();
try {
Object ob = execute();
if (ob instanceof List) {
List ret = (List) ob;
if (ret instanceof ResultList) {
RuntimeExceptionTranslator trans = PersistenceExceptions.getRollbackTranslator(_em);
if (_query.isDistinct()) {
return new DistinctResultList((ResultList) ret, trans);
} else {
return new DelegatingResultList((ResultList) ret, trans);
}
} else {
return ret;
}
}
return Collections.singletonList(ob);
} finally {
popQueryFetchPlan(queryFetchPlanUsed);
}
}
代码示例来源:origin: org.apache.openjpa/openjpa-all
public List getResultList() {
_em.assertNotCloseInvoked();
boolean queryFetchPlanUsed = pushQueryFetchPlan();
try {
Object ob = execute();
if (ob instanceof List) {
List ret = (List) ob;
if (ret instanceof ResultList) {
RuntimeExceptionTranslator trans = PersistenceExceptions.getRollbackTranslator(_em);
if (_query.isDistinct()) {
return new DistinctResultList((ResultList) ret, trans);
} else {
return new DelegatingResultList((ResultList) ret, trans);
}
} else {
return ret;
}
}
return Collections.singletonList(ob);
} finally {
popQueryFetchPlan(queryFetchPlanUsed);
}
}
代码示例来源:origin: org.apache.openjpa/openjpa-persistence
public List getResultList() {
_em.assertNotCloseInvoked();
boolean queryFetchPlanUsed = pushQueryFetchPlan();
try {
Object ob = execute();
if (ob instanceof List) {
List ret = (List) ob;
if (ret instanceof ResultList) {
RuntimeExceptionTranslator trans = PersistenceExceptions.getRollbackTranslator(_em);
if (_query.isDistinct()) {
return new DistinctResultList((ResultList) ret, trans);
} else {
return new DelegatingResultList((ResultList) ret, trans);
}
} else {
return ret;
}
}
return Collections.singletonList(ob);
} finally {
popQueryFetchPlan(queryFetchPlanUsed);
}
}
代码示例来源:origin: org.apache.openejb.patch/openjpa-persistence
public List getResultList() {
_em.assertNotCloseInvoked();
boolean queryFetchPlanUsed = pushQueryFetchPlan();
try {
Object ob = execute();
if (ob instanceof List) {
List ret = (List) ob;
if (ret instanceof ResultList) {
RuntimeExceptionTranslator trans = PersistenceExceptions.getRollbackTranslator(_em);
if (_query.isDistinct()) {
return new DistinctResultList((ResultList) ret, trans);
} else {
return new DelegatingResultList((ResultList) ret, trans);
}
} else {
return ret;
}
}
return Collections.singletonList(ob);
} finally {
popQueryFetchPlan(queryFetchPlanUsed);
}
}
代码示例来源:origin: org.apache.openjpa/openjpa-persistence
/**
* Execute a query that returns a single result.
*/
public X getSingleResult() {
_em.assertNotCloseInvoked();
setHint(QueryHints.HINT_RESULT_COUNT, 1); // for DB2 optimization
boolean queryFetchPlanUsed = pushQueryFetchPlan();
try {
List result = getResultList();
if (result == null || result.isEmpty())
throw new NoResultException(_loc.get("no-result", getQueryString())
.getMessage());
if (result.size() > 1)
throw new NonUniqueResultException(_loc.get("non-unique-result",
getQueryString(), result.size()).getMessage());
try {
return (X)result.get(0);
} catch (Exception e) {
throw new NoResultException(_loc.get("no-result", getQueryString())
.getMessage());
}
} finally {
popQueryFetchPlan(queryFetchPlanUsed);
}
}
代码示例来源:origin: org.apache.openjpa/openjpa-all
/**
* Execute a query that returns a single result.
*/
public X getSingleResult() {
_em.assertNotCloseInvoked();
setHint(QueryHints.HINT_RESULT_COUNT, 1); // for DB2 optimization
boolean queryFetchPlanUsed = pushQueryFetchPlan();
try {
List result = getResultList();
if (result == null || result.isEmpty())
throw new NoResultException(_loc.get("no-result", getQueryString())
.getMessage());
if (result.size() > 1)
throw new NonUniqueResultException(_loc.get("non-unique-result",
getQueryString(), result.size()).getMessage());
try {
return (X)result.get(0);
} catch (Exception e) {
throw new NoResultException(_loc.get("no-result", getQueryString())
.getMessage());
}
} finally {
popQueryFetchPlan(queryFetchPlanUsed);
}
}
代码示例来源:origin: org.apache.openejb.patch/openjpa-persistence
/**
* Execute a query that returns a single result.
*/
public X getSingleResult() {
_em.assertNotCloseInvoked();
setHint(QueryHints.HINT_RESULT_COUNT, 1); // for DB2 optimization
boolean queryFetchPlanUsed = pushQueryFetchPlan();
try {
List result = getResultList();
if (result == null || result.isEmpty())
throw new NoResultException(_loc.get("no-result", getQueryString())
.getMessage());
if (result.size() > 1)
throw new NonUniqueResultException(_loc.get("non-unique-result",
getQueryString(), result.size()).getMessage());
try {
return (X)result.get(0);
} catch (Exception e) {
throw new NoResultException(_loc.get("no-result", getQueryString())
.getMessage());
}
} finally {
popQueryFetchPlan(queryFetchPlanUsed);
}
}
代码示例来源:origin: org.apache.openejb.patch/openjpa
/**
* Execute a query that returns a single result.
*/
public X getSingleResult() {
_em.assertNotCloseInvoked();
setHint(QueryHints.HINT_RESULT_COUNT, 1); // for DB2 optimization
boolean queryFetchPlanUsed = pushQueryFetchPlan();
try {
List result = getResultList();
if (result == null || result.isEmpty())
throw new NoResultException(_loc.get("no-result", getQueryString())
.getMessage());
if (result.size() > 1)
throw new NonUniqueResultException(_loc.get("non-unique-result",
getQueryString(), result.size()).getMessage());
try {
return (X)result.get(0);
} catch (Exception e) {
throw new NoResultException(_loc.get("no-result", getQueryString())
.getMessage());
}
} finally {
popQueryFetchPlan(queryFetchPlanUsed);
}
}
内容来源于网络,如有侵权,请联系作者删除!