-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: HQLQueryPlan.performList method blocks
PostPosted: Fri Feb 08, 2008 12:37 am 
Newbie

Joined: Tue Nov 13, 2007 7:08 pm
Posts: 10
Location: Australia
Hi Hibernate Users!

I am experiencing trouble with a particular HQL query:

Code:
select domain from Domain as domain left outer join domain.mostRecentlySeen as recent where recent.lastSeen < :recentPast


In english:

Quote:
Select all instances of Domain whose 'mostRecentlySeen' (bidirectional one-to-one) association has a 'lastSeen' date before a certain date in the recent past.


where mostRecentlySeen joins to a different table using foreign key.

I use the following code (inside a try block and surrounded by lots of logging) to build and execute the query.

Code:
Query nextPage;
Calendar recentPast = ...;
int pageSize = ...;

nextPage = session.createQuery("select ...").setTimestamp("recentPast", recentPast.getTime()).setMaxResults(pageSize);
domains = (List<Domain>) nextPage.list();


Yet the list method never returns and doesn't raise an exception. I have tried various variations including:
    Omitting the setMaxResults constraint.
    Comparing the dates using SQL TIMESTAMPDIFF function.
    Using setDate, setCalendar, etc. instead of setTimestamp

Yet in each case the org.hibernate log messages end with the followings lines:

Code:
2008-02-08 15:09:41,047|DEBUG|org.hibernate.impl.SessionFactoryObjectFactory<main> - initializing class SessionFactoryObjectFactory
2008-02-08 15:09:41,048|DEBUG|org.hibernate.impl.SessionFactoryObjectFactory<main> - registered: 4a2ed68417f73c010117f73c03b50000 (unnamed)
2008-02-08 15:09:41,049| INFO|org.hibernate.impl.SessionFactoryObjectFactory<main> - Not binding factory to JNDI, no JNDI name configured
2008-02-08 15:09:41,049|DEBUG|org.hibernate.impl.SessionFactoryImpl<main> - instantiated session factory
2008-02-08 15:09:41,051|DEBUG|org.hibernate.impl.SessionFactoryImpl<main> - Checking 0 named HQL queries
2008-02-08 15:09:41,051|DEBUG|org.hibernate.impl.SessionFactoryImpl<main> - Checking 0 named SQL queries
2008-02-08 15:09:41,278|DEBUG|org.hibernate.impl.SessionImpl<Thread-1> - opened session at timestamp: 12024437812
2008-02-08 15:09:41,278|DEBUG|org.hibernate.impl.SessionImpl<Thread-1> - setting flush mode to: COMMIT
2008-02-08 15:09:41,279|DEBUG|org.hibernate.transaction.JDBCTransaction<Thread-1> - begin
2008-02-08 15:09:41,279|DEBUG|org.hibernate.jdbc.ConnectionManager<Thread-1> - opening JDBC connection
2008-02-08 15:09:41,279|DEBUG|org.hibernate.connection.DriverManagerConnectionProvider<Thread-1> - total checked-out connections: 0
2008-02-08 15:09:41,279|DEBUG|org.hibernate.connection.DriverManagerConnectionProvider<Thread-1> - using pooled JDBC connection, pool size: 0
2008-02-08 15:09:41,279|DEBUG|org.hibernate.transaction.JDBCTransaction<Thread-1> - current autocommit status: false
2008-02-08 15:09:41,279|DEBUG|org.hibernate.jdbc.JDBCContext<Thread-1> - after transaction begin
2008-02-08 15:09:41,282|DEBUG|org.hibernate.engine.query.QueryPlanCache<Thread-1> - unable to locate HQL query plan in cache; generating (select domain from Domain as domain left outer join domain.mostRecentlySeen as recent where recent.lastSeen < :recentPast )
2008-02-08 15:09:41,327|DEBUG|org.hibernate.hql.ast.QueryTranslatorImpl<Thread-1> - parse() - HQL: select domain from com.auststyle.watch.registry.au.AuDomain as domain left outer join domain.mostRecentlySeen as recent where recent.lastSeen < :recentPast
2008-02-08 15:09:41,339|DEBUG|org.hibernate.hql.ast.AST<Thread-1> - --- HQL AST ---
*snip*
2008-02-08 15:09:41,410|DEBUG|org.hibernate.hql.ast.ErrorCounter<Thread-1> - throwQueryException() : no errors
2008-02-08 15:09:41,419|DEBUG|org.hibernate.hql.ast.QueryTranslatorImpl<Thread-1> - HQL: select domain from com.auststyle.watch.registry.au.Domain as domain left outer join domain.mostRecentlySeen as recent where recent.lastSeen < :recentPast
2008-02-08 15:09:41,419|DEBUG|org.hibernate.hql.ast.QueryTranslatorImpl<Thread-1> - SQL: select domain0_.dom_id as dom1_0_, domain0_.name as name0_, domain0_.mostRecentlySeen as mostRece4_0_ from domain domain0_ left outer join domain_watch watcheddom1_ on domain0_.mostRecentlySeen=watcheddom1_.dw_id where domain0_.discriminator='xyz' and watcheddom1_.lastSeen<?
2008-02-08 15:09:41,419|DEBUG|org.hibernate.hql.ast.ErrorCounter<Thread-1> - throwQueryException() : no errors
2008-02-08 15:09:41,426|DEBUG|org.hibernate.engine.query.HQLQueryPlan<Thread-1> - HQL param location recognition took 2 mills (select domain from Domain as domain left outer join domain.mostRecentlySeen as recent where recent.lastSeen < :recentPast )
2008-02-08 15:09:41,433|DEBUG|org.hibernate.engine.query.QueryPlanCache<Thread-1> - located HQL query plan in cache (select domain from Domain as domain left outer join domain.mostRecentlySeen as recent where recent.lastSeen < :recentPast )
2008-02-08 15:09:41,433|DEBUG|org.hibernate.engine.query.HQLQueryPlan<Thread-1> - find: select domain from Domain as domain left outer join domain.mostRecentlySeen as recent where recent.lastSeen < :recentPast


That last log message is inside HQLQueryPlan.performList method (AFAIK), hence the subject of this post.

Why won't my query execute? I have tested the SQL directly against the database (it's MySQL 5.0, BTW). I am at my wits end, please help.

Corin.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.