I've got an entity which does have a relation to itself (child - parent).
If i want to delete it, i must do this in the correct order or the constraint is violated.
HQL Query is:
2012-08-23 13:13:18,757 [qtp196024597-447] DEBUG org.hibernate.hql.internal.ast.QueryTranslatorImpl [QueryTranslatorImpl.java:265] - parse() - HQL: delete from de.test.entity.PageURL s where s.channel = :channel order by s.id desc
Result which is executed is:
2012-08-23 13:13:18,797 [qtp196024597-447] DEBUG org.hibernate.SQL [SqlStatementLogger.java:104] - delete from PageURL where channel_id=?
The order by clause is missing (AST Parser does seem to ignore it and does not even bail about, that it will be ignored) and the query fails, adding the missing part and do it via mysql commandline and things work like expected.
|