java - delete record by any column value hibernate -
I am new to hibernate, I am learning to be struts2 + hibernate and understand from the example on the net. In one of the examples what I can see and do, remove the user from their ID, as we can see here, each user in the list has a remove link and the session . Delete () deletes the record by id, now I want the user to enter a name in the text field given there and delete it by that name. So far I've tried this type of ActionMethod: delete public string () {// HttpServletRequest request = (HttpServletRequest) ActionContext .getContext () .get (Serial Action Context.httpiequost); // UsdiododelUser (long.parlong (request.getParameter ("id")); UserDAO.delUser (user.getName ()); Return success; } DAOImpl: @ Override Public Zero Dealuser (string username) {try user user = (user) session .get (User.class, userName); Session.delete (user); } Hold (exception e) {transaction.rollback (); E.printStackTrace (); }} I hope there is a way that hibernation can rem...