-->
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: HQL Abstract Syntax Tree Generator
PostPosted: Wed Nov 12, 2003 7:43 am 
Contributor
Contributor

Joined: Thu Nov 06, 2003 9:49 pm
Posts: 104
Location: New York, NY
gavin wrote:
Here is the best I can give you ... probably broken, since I never tested it...


http://www.hibernate.org/Documentation/HQLBNF


Thanks, that helps a lot. However, it is incomplete (a.k.a. 'broken'). I've got basic SELECT, FROM, and JOIN clauses parsing now, but I'm getting a little bogged down on the logical expression for the WHERE clause. Does HQL support *all* of the logical expression variants that SQL does?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 12, 2003 8:03 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Essentially, yes.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 12, 2003 9:53 am 
Contributor
Contributor

Joined: Thu Nov 06, 2003 9:49 pm
Posts: 104
Location: New York, NY
A few questions, if I may:

1) The BNF indicates that the 'HAVING' clause can exist without being preceeded by 'GROUP BY'. Does this make sense? Other SQL BNF's make the 'HAVING' clause an optional element of 'GROUP BY'.

2) The following rules are not referenced in the BNF:

collection: ( OPEN query CLOSE ) | ( 'elements'|'indices' OPEN path CLOSE );

quantifiedExpression: 'exists' | ( expression 'in' ) | ( expression OP 'any' | 'some' ) collection;

compoundPath: path ( OPEN_BRACKET expression CLOSE_BRACKET ( '.' path )? )*;

What are they for, and where should they be used?

3) COUNT() has it's own special cases (e.g. '*'), but should this really be handled by the grammar?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 12, 2003 10:02 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
1) No, you can't have a HAVING w/o a GROUP BY, though the rules about HAVING + GROUP BY will change soon.

2) The first two of these things are for subqueries. See the Hibernate doco.
The third is for accessing collections by index: foo.bars["x"].baz.fum

3) I have no idea. Depends how easy/hard it is, I suppose....


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.