facebook

Problem with session.createSQLQuery!

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #254200 Reply

    Ghazalawahid
    Member

    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 ?

    #254201 Reply

    Ghazalawahid
    Member

    its not remove from student,delete from student where std_id = ” + primkarykey

    #254202 Reply

    Ghazalawahid
    Member

    its overwriting my sql statement with remove.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Problem with session.createSQLQuery!

You must be logged in to post in the forum log in