本文整理了Java中org.apache.openjpa.persistence.QueryImpl.setHint
方法的一些代码示例,展示了QueryImpl.setHint
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueryImpl.setHint
方法的具体详情如下:
包路径:org.apache.openjpa.persistence.QueryImpl
类名称:QueryImpl
方法名:setHint
暂无
代码示例来源:origin: org.apache.openjpa/openjpa-all
@Override
public StoredProcedureQuery setHint(String hintName, Object value) {
_delegate.setHint(hintName, value);
return this;
}
代码示例来源:origin: org.apache.openjpa/openjpa-persistence
@Override
public StoredProcedureQuery setHint(String hintName, Object value) {
_delegate.setHint(hintName, value);
return this;
}
代码示例来源: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);
}
}
内容来源于网络,如有侵权,请联系作者删除!