HibernateQueryException: Not supported for DML operations
Hi all, I got this strange exception
HibernateQueryException: Not supported for DML operations
delete from com.avid.interplay.tags.TagAssignment
assignment
where assignment.element = :element
and assignment.tag = :tag
by executing a Hibernate query:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
delete from com.avid.interplay.tags.TagAssignment
assignment
where assignment.element = :element
and assignment.tag = :tag
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Looks like DML clauses are not supported? But another piece similar
code runs fine.
I am using Hibernate 3 with a hsql server.
where TagAssignment looks like
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public class TagAssignment {
private Long id;
private ElementProxy element;
private Tag tag;
protected TagAssignment() {
}
public TagAssignment(ElementProxy element, Tag category) {
this.element = element;
this.tag = category;
}
public ElementProxy getElement() {
return element;
}
public Tag getTag() {
return tag;
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
This is my method call:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
HibernateCallback callback = new HibernateCallback() {
public Object doInHibernate(Session session) throws
HibernateException, SQLException {
Query query =
session.getNamedQuery("com.avid.interplay.tags.TagAssignment.deleteFromProxy");
query.setParameter("element", element);
query.setParameter("tag", tag);
return query.list();
}
};
getHibernateTemplate().execute(callback);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Thanks a lot.