I am trying to delete a particular record from table student(MySql) and mapping class file name is Student. I am trying to do this using session.createSQLQuery ,its not giving any error in code but not deleting the record. Code is :
public static void deleteStudent(int primarykey) {
try {
Session session = SessionManager.currentSession();
Transaction tx = session.beginTransaction();
session.createSQLQuery(“delete from Student where std_Id = ” + primarykey );
tx.commit();
session.close();
System.out.println(“delete successfull”)
Am I writing the wrong query syntax or data type mismatch problem ?