It depends on what your reasons for wanting the difference names are ?
The "(FactoryItem) order.items" is java-like and understandable right away
by 90% of current hibernate users....btw. should it not be (FactoryItem) (order.items) if one is
to follow the normal precedence orders for casts ?
The CAST syntax is uglier, but has a more query-languish look - and will probably be
understood by 70-80% of the users....the precedence order question is also valid here...
The NARROW stuff is the less understandable from the current hibernate user base ;)
It is something that smells of big ORM query languages and J2EE/Corba calls, but it
is probably also most similar to that ....
I would say I prefer the () syntax since it much better understandable and reduces the
likeliness of misunderstanding.....unless this stuff really is more like a narrow than a cast...?
(and that we have a work-in-progress on the createsqlquery that uses the () syntax to "cast"
aliases to use in non-* join-subclass queries)
Get my drift ? ;)
I guess ease-of-parsing is also a player, but first up is the "understandability" of the syntax, right ? ;)
/max
Gavin King wrote:
Actually, "narrow" is better than "cast":
FROM Order AS order JOIN order.items NARROW FactoryItem AS item
Gavin King wrote:
William Drai has submitted a very clever little patch to add class casts to HQL.
I must be stupid, 'cos it never occurred to me that casts shoudl really be expressed in the FROM clause, and that makes them /much/ easier to implement. Usually people have proposed it as something to go in the WHERE clause, which is harder to implement and perhaps less elegant.
So, William's patch does it like:
FROM Order AS order JOIN (FactoryItem) order.items AS item
I think it would be better as this:
FROM Order AS order JOIN order.items CAST FactoryItem AS item
Which is better? Any other suggestions?
------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
