[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
[eclipselink-users] Duration of a simple object query
|
- From: Holger Rieß <Holger.Riess@xxxxxxxxxxxxxxxxxx>
- Date: Mon, 3 Aug 2009 16:01:16 +0200
- Accept-language: de-DE
- Acceptlanguage: de-DE
- Delivered-to: eclipselink-users@eclipse.org
- Thread-index: AcoUQt6e5OFxeO7gSUuWuHB4OWdluA==
- Thread-topic: 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.