Delete « HBM « JPA Q&A

1. Delete element from Set

I have 2 classes Tema(Homework) and Disciplina (course), where a Course has a Set of homeworks. In Hibernate i have mapped this to a one-to-many associations like this:

<class name="model.Disciplina" table="devgar_scoala.discipline" ...

3. DELETE in HIBERNATE hbm.xml

1)hbm.xml: DELETE FROM PHAIREP WHERE (phairep.AIALCD = 'C') 2) PersistenceManager //DELETE String hql = string; Query query = (Query) session.getNamedQuery(hql); Query query2 = session.createSQLQuery(query.getQueryString()); query2.executeUpdate(); This does not work. It says: update is only possible in HQL. cant we write update, delete queries in this format in out hbm.xml