[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5785) HQL UPDATE omits alias when referencing an entity
Ondrej Medek (JIRA)
noreply at atlassian.com
Fri Dec 10 07:00:13 EST 2010
HQL UPDATE omits alias when referencing an entity
-------------------------------------------------
Key: HHH-5785
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5785
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.3.1
Environment: Hibernate 3.3.1 in JBoss AS 5.1.0, org.hibernate.dialect.HSQLDialect
Reporter: Ondrej Medek
HQL UPDATE:
UPDATE Lesson e SET e.state = 'N' WHERE EXISTS (SELECT 1 FROM LessonOrder lso WHERE lso.lesson = e)
produces wrong SQL:
update LESSON set lsn_state='N' where exists (select 1 from LESSON_ORDER lessonorde1_ where lessonorde1_.lsn_id=lsn_id)
since in the database exists columns if the same name: LESSON.lsn_id and LESSON_ORDER.lsn_id. The problem is, that Hibernate omits the alias "e" in the SQL. When I make a little different query:
UPDATE Lesson e SET e.state = 'N' WHERE EXISTS (SELECT 1 FROM LessonOrder lso WHERE lso.lesson.id = e.id)
then the resulting SQL is right:
update LESSON set lsn_state='N' where exists (select 1 from LESSON_ORDER lessonorde1_ where lessonorde1_.lsn_id=LESSON.lsn_id)
However, I think the Hibernate should not omit the alias "e" in either case.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list