Having @version in Parent causes wrong HQL update when updating subclass in Joined
Subclass Inheritance Strategy.
-----------------------------------------------------------------------------------------------------------------
Key: HHH-3590
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3590
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.3.1
Environment: Java 1.5 , Oracle 10g , Hibernate 3.3.1.GA
Reporter: Rachit
Priority: Blocker
A very simple joined subclass strategy implemented.
2 classes: Employee(parent/superclass) and Person( child/subclass)
Employee has @Version defined on column ROW_VERSION and Person extends Employee using
Joined Inheritance Strategy. Person has PERSON_ID as PK and Employee has EMPLOYEE_ID as
PK. I also have @PrimaryKeyJoinColumn(name = "PERSON_ID", referencedColumnName =
"EMPLOYEE_ID") for obvious reason.
Now if I update any attribute in Child class i.e Person.setVIPFlag("Y") ,
hibernate fires an update query on Parent entity with wrong column name in hql. In this
case the query would be "update EMPLOYEE set ROW_VERSION=? where PERSON_ID=? and
ROW_VERSION=?". This query fails as EMPLOYEE does not have PERSON_ID.
The moment I remove @Version annotation from Parent(Employee) class, there is no update (
as expected ) and hence no error, but this is not an acceptable solution.
Thanking in anticipation.
--
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