Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Duration of a simple object query

My query
	...
	Query query = em.createNamedQuery("findStockTableByItemNumber");
	query.setParameter("itemnumber", itemNumber);
	retStockTable = (Stocktable) query.getSingleResult();
	...
needs about 15 ms if there is a record in the database and about 70 ms if there is no record (profiler).

The named query is ...
@NamedQuery(name = "findStockTableByItemNumber", query = "SELECT st FROM Stocktable st WHERE st.itemnumber = 	:itemnumber AND st.dataset = 'DAT' AND st.cKatalog = '001'", hints = {
		@QueryHint(name = QueryHints.CACHE_USAGE, value = CacheUsage.CheckCacheThenDatabase),
		@QueryHint(name = QueryHints.QUERY_TYPE, value = QueryType.ReadObject) }),
...

About 40% of my queries have no result - this is a great problem for the performance of my application.
There is no additional code for the handling of NoResultException.


Back to the top