According to the hibernate reference quide section 11.2 (page 83 in the pdf, hibernate version 2.1.4)... You can specify an alias for a class so that you can reference the class later the query.

I experimented to see what would happen if I did not. Let's say MyClass get's mapped to table my_class..

Hql without alias: from MyClass where MyClass.col='val'
generated sql: select .... from my_class my_class0_ where (MyClass.col='val')


Clearly, the generated sql is going to fail.. the Class name was used in the where clause instead of an alias. Things work ok with the alias of course.

My point is, maybe the documentation could be more explicit that you must have an object alias. (It took me a while to figure out why a query wasn't working ;-)

I can also see that hibernate could probably generate sql correctly without the alias that was something someone wanted to handle that, but it didn't seem to me to be a bug yet.

Thanks
Dennis



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to