public static <T> T getSingleResult(Query query) {
query.setMaxResults(1);
List<?> list = query.getResultList();
if (list == null || list.size() == 0) {
return null;
}
return (T) list.get(0);
}
2014年4月17日
[JAVA][JPA] 處理getSingleResult沒有值
可用方法之一:
2014年2月5日
[JAVA][JPA] no cache
在persistence.xml 的 <properties>
加入 <property name="toplink.cache.type.default" value="NONE"/>
加入 <property name="toplink.cache.type.default" value="NONE"/>
訂閱:
文章 (Atom)