Issue Details (XML | Word | Printable)

Key: HHH-369
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Steve Ebersole
Reporter: Robert Watkins
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Hibernate Core

Deleting subclasses generates invalid SQL

Created: 18/Apr/05 11:31 PM   Updated: 19/Apr/05 07:39 PM   Resolved: 19/Apr/05 09:26 AM
Component/s: None
Affects Version/s: None
Fix Version/s: 3.0.1

Time Tracking:
Not Specified

Bug Testcase Reminder (view):
REMINDER: Bug reports should generally be accompanied by a test case
Participants: Robert Watkins and Steve Ebersole


 Description  « Hide

When I try to delete a subclass entity, the resulting SQL is bad; it appears to be assuming an alias is being used when it isn't.

Mapping file (partial):
<hibernate-mapping>
<class name="com.wotif.jaguar.domain.Comment"
table="COMMENTS" dynamic-update="false" dynamic-insert="false"
select-before-update="false" optimistic-lock="version"
discriminator-value="null" >
...
<subclass
name="com.wotif.jaguar.domain.property.PropertyComment"
dynamic-update="false"
dynamic-insert="false"
discriminator-value="0"
>
...
</class>
</hibernate-mapping>

19/04/2005 14:25:20 org.hibernate.hql.ast.QueryTranslatorImpl generate FINE: HQL: delete from com.wotif.jaguar.domain.property.PropertyComment
19/04/2005 14:25:20 org.hibernate.hql.ast.QueryTranslatorImpl generate FINE: SQL: delete from COMMENTS where propertyco0_.CommentType=0

Under Hibernate 2.1.6, the generated SQL was:

delete from COMMENTS propertyco0_ where propertyco0_.CommentType = 0

My guess: the change to remove aliasing for update/deletes caused this to break.



Steve Ebersole added a comment - 19/Apr/05 08:38 AM

Thanks for (at least) the 5th bug report on this. I am getting mildly annoyed with having to answer this over and over.

This has been fixed in CVS for almost 3 weeks now. Fixes released in 3.0.1.


Robert Watkins added a comment - 19/Apr/05 04:24 PM

Steve, I did a search before looking. I looked for "delete subclass", "deleting subclass", "cascade delete subclass", and a buch of other keywords. Didn't find any. I can't talk about the four other people had the same problem.

I'm happy it's fixed in 3.0.1, which was released at about the same time I lodged the bug, and the day after I discovered it. It happens.


Robert Watkins added a comment - 19/Apr/05 07:39 PM

I confirm it's fixed in 3.0.1.