Unable to delete an entry-Springs MVC Hibernate -
i trying delete entry through spring mvc unable it.i getting 404
error stating requested resource not found.
my controller code is
@requestmapping("/delete/{user_id}") public modelandview deleteuser(@pathvariable("user_id")integer user_id){ userservice.removeuser(user_id); return new modelandview("redirect:/userlist.html"); }
and going userservice
, there going userserviceimpl
, there userdao
userdaoimpl
code is
public void removeuser(integer user_id){ user user = (user) sessionfactory.getcurrentsession().load( user.class, user_id); if (null != user) { sessionfactory.getcurrentsession().delete(user); system.out.println("successfully deleted"); }
i did hibernate.show_sql=true
int properties file still delete getting select
statement.
wrap delete code transaction:
session session = sessionfactory.getcurrentsession(); transaction t = session.begintransaction(); user user = (user) session.load(user.class, user_id); if (null != user) { session.delete(user); system.out.println("successfully deleted"); } session.flush(); t.commit()