Skip to main content

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

You may also consider using a query cache, if you wish to avoid database
access.

See,
http://www.eclipse.org/eclipselink/api/1.1.2/org/eclipse/persistence/config/QueryHints.html#QUERY_RESULTS_CACHE


Holger Rieß-2 wrote:
> 
> 
> 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.
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/Duration-of-a-simple-object-query-tp24791421p25045098.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top