The problem occurs because both ANTLR and the semantic action are building sub-trees in hql-sql.g. Before my most recent changes, this actually resulted in some AST nodes being completely discarded (i.e. not in the tree, anywhere), which was just plain wrong.
What I plan to do is to have hql-sql.g1 create trees only from ANTLR, and not from semantic action so that the output tree will look very much like the input tree. Implicit joins created while the FROM clause is being parsed will have to be stored for later attachment to the output tree, and implicit joins created elsewhere can be directly added to the FROM clause in a more straightforward manner. > -----Original Message----- > From: Gavin King [mailto:[EMAIL PROTECTED] > Sent: Saturday, February 26, 2005 9:49 AM > To: 'hibernate-devel@lists.sourceforge.net'; Joshua Davis > Subject: nested joins > > > A query like this: > > from Dog d join d.owner h join h.friends f > > Results in the following broken subtree: > > +-[FROM] 'from' FromClause{from} > | +-[FROM_FRAGMENT] 'Dog dog0_ inner join DomesticAnimal dog0_1_ . > | | +-[JOIN_FRAGMENT] 'inner join Human human1_ on > dog0_1_.owner=human1_.mammal inner join Mammal human1_1_ . > | | \-[JOIN_FRAGMENT] 'inner join friends friends2_ on > human1_.mammal=friends2_.human1 inner join Human human3_ . > | \-[JOIN_FRAGMENT] 'inner join friends friends2_ on > human1_.mammal=friends2_.human1 inner join Human human3_ . > > Where you can see the same JOIN_FRAGMENT (the same actual > node instance) > is the child of two different parents. I've been pulling my hair out > trying to figure out how exactly the JOIN_FRAGMENTS come to > be attached > to parents, and I just can't figure it out. Since this is absolutely > central functionality, I'd really like it if this worked in a more > "obvious" way (or perhaps I'm just stupid). > > Anyway, can someone explain it to me so I can try to fix the > bug? Thanks.... > > Cheers, Gavin > > -- > Gavin King > +61 410 534 454 > +1 404 822 8349 > callto://gavinking > > Hibernate > [EMAIL PROTECTED] > http://hibernate.org > > JBoss Inc > [EMAIL PROTECTED] > http://jboss.com > ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click _______________________________________________ hibernate-devel mailing list hibernate-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/hibernate-devel