I have an object -
@Entity
public class myObject{
public string fieldA;
public string fieldB
...
}
I don't have any instance of it but I want to delete all the rows in db that have
fieldA == A.
Is this the correct way ?
try {
session.beginTransaction();
session.createQuery("delete from MyObject where fieldA = " +
"BlaBla").executeUpdate();
session.getTransaction().commit();
savedSuccessfully = true;
} catch (HibernateException e) {
session.getTransaction().rollback();
savedSuccessfully = false;
} finally {
session.close();
}
return savedSuccessfully;