]
Steve Ebersole closed HHH-873.
------------------------------
Closing stale resolved issues
referencing raw HQL FromElement alias outide the from clause of
update and delete statements generates incorrect sql
--------------------------------------------------------------------------------------------------------------------
Key: HHH-873
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-873
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.0.5
Environment: 2.6.11-gentoo-r4
sun-jdk-1.5.0.04
jboss-4.0.3RC1 (I guess 3.1alpha1)
postgresql-8.0.3
jdbc3-postgresql-7.4.5
Reporter: Emmanuel Bernard
Assignee: Steve Ebersole
Fix For: 3.1 rc 1
Move from
http://jira.jboss.com/jira/browse/EJBTHREE-259
Two very simple entities one owns the other with OneToOne Cascade=ALL
relation.
@Entity
E1
@id AUTO
long id
@OneToOne(Cascade=ALL)
E2 e2
@Entity
E2
@id AUTO
long id
This HQL is intended to delete all orphan e2 entities.
HQL :
"delete from E2 e2 where e2 not in (select e1.e2 from E1 e1 where e1.e2 is not
null)"
it generates on postgresql
"delete from E2 where e2x0_.id not in (select e2_id from E1 e1x1_ where e2x_id is
not null)"
which misses the E2 table alias and fails with "relation e2x0_ does not
exist".
If I use instead
HQL :
"delete from E2 e2 where e2.id not in (select e1.e2.id from E1 e1 where e1.e2 is not
null)"
then it generates:
"delete from E2 where id not in (select e2_id from E1 e1x1_ where e2x_id is not
null)"
which does not access id by table alias and succeeds.
I guess table aliases are not always correctly generated
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: