-->
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.  [ 4 posts ] 
Author Message
 Post subject: Request: HQL parser generating HQL DOM
PostPosted: Wed Jun 20, 2007 3:09 pm 
Expert
Expert

Joined: Fri Oct 28, 2005 5:38 pm
Posts: 390
Location: Cedarburg, WI
Hibernate version: 1.20

Nearly all of our data access is via HQL rather than the criteria API or by individually loading entities by ID. We also have requirements to add criteria programatically to an HQL based query. Finally, we've made an HQL editor / query analyzer that provides some Intellisense (in particular, it opens completion listboxes for available entity names and applicable property names).

To do all this, we've written our own lame, kludgey, home-brew HQL parser. We'd really like to use NHibernate's internal parser, but when I look at the code, it is written specifically for translating HQL to SQL. Specifically, it parses HQL and modifies a QueryTranslator object. This QueryTranslator contains information on how to build the SQL, but not information about the structure of the original HQL. What we need is a parser that builds a DOM of the HQL query. That way, the DOM could be consumed for a variety of different purposes, SQL generation being only one of them.

Is anyone else interested in getting a DOM from HQL text? If someone can work with me on this enhancement (someone more familiar than me with parsers and state machines) I'm confident that we could make it available in the next NHibernate release.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 20, 2007 3:32 pm 
Expert
Expert

Joined: Fri Oct 28, 2005 5:38 pm
Posts: 390
Location: Cedarburg, WI
The requested DOM could be an extension of the Criteria API ...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 20, 2007 4:07 pm 
Expert
Expert

Joined: Fri Oct 28, 2005 5:38 pm
Posts: 390
Location: Cedarburg, WI
Ayende Rahien suggested what is probably the best approach, in this post, to get an Abstract Syntax Tree:

http://forum.hibernate.org/viewtopic.php?t=967914

Quote:
Off the top of my head, I would say that it would be easier to take the Antlar code from Hibernate 3.0, generate C# AST, and work with that.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 21, 2007 10:45 am 
Expert
Expert

Joined: Fri Oct 28, 2005 5:38 pm
Posts: 390
Location: Cedarburg, WI
A JIRA issue has been created. If you are interested in getting an HQL parser that generates an Abstract Syntax Tree, please vote for it ...

http://jira.nhibernate.org/browse/NH-1051


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

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.