[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1657?page=c...
]
Sebastian Anzani commented on HHH-1657:
---------------------------------------
Hello, i have found the same problem trying to delete a hierarchy having a composite
primary key, the HQL statement that I am trying to execute is the following
delete from Employee _emp where concat(_emp.lastName,'_$$_',_emp.firstName)
in(:values)
in my case case "Employee" extends "Person" and the SQL query
generated to fill the temporary table used for bulk delete is the following:
insert into
HT_employee
select
employee0_.`LASTNAME` as `LASTNAME`,
employee0_.`FIRSTNAME` as `FIRSTNAME`
from
`employee` employee0_
inner join
`person` employee0_1_
on employee0_.`LASTNAME`=employee0_1_.`LASTNAME`
and employee0_.`FIRSTNAME`=employee0_1_.`FIRSTNAME`
where
concat(`LASTNAME`, '_$$_', `FIRSTNAME`) in (
?
)
Obviously the problem is caused by the missing of the correct entity alias into the concat
function of the where clause.
hql update generate wrong sql with joined subclass hierarcy
-----------------------------------------------------------
Key: HHH-1657
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1657
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Environment: Hibernate 3.2.0cr1, Hibernate 3.1.3
Reporter: Alexey Romanchuk
Assignee: Gail Badner
Let suppose that we have two joined subclass entities: Parent (id PK) and Child (id PK)
that mapped with joined subclass method.
When I try to update Child by id with hql:
update Child c set c.field = 'value' where c.id = 1234
hibernate generates joined tables like
insert into HT_parent select child0_.id as id from child child0_ inner join parent
child0_1_ on child0_.id=child0_1_.id wher id in = 1234
look at last condition. hibernate use id WITH OUT tables alias that cause sql exception:
column reference "id" is ambiguous
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira