Reputation: 53
When running the delete method for an object it does not get delelted from the database
Delete query
@NamedQuery(
name = "deleteAppointment",
query = "delete Appointment t where t.id = : id"
),
Method for deleting the appointment
public void deleteAppointment2(Integer appId){
Session session = factory.openSession();
Transaction tx = null;
try {
tx = session.beginTransaction();
TypedQuery query = session.getNamedQuery("deleteAppointment");
query.setParameter("id", appId);
query.executeUpdate();
}catch (HibernateException e){
e.printStackTrace();
}
}
Yet when I run the method it does not delete the appointment
Upvotes: 0
Views: 43