Hello.
I'm having a basic problem. Maybe this problem relies on how my application uses hibernate 2.1 with Tomcat 5.0.16.
I'm developing a simple WEB application that interacts with database throw hibernate framework.
So, supose the following scenario:
User at page ShowUserInformation.jsp clicks on button delete, which sends the user to another JSP (say, UserDelete.jsp) page that receives use userId as parameter.
At page UserDelete.jsp, I will use hibernate to delete the UserData (the table key is user_id) object from database, with something like this:
Code:
UserData user = new UserData();
user.setUserId(request.getParameter("userId"));
tx = session.beginTransaction();
session.delete(user);
tx.commit();
However,at this point, it throws an exception that user object is not persistent since some of its atributes are "not-null".
I wonder, the only way to delete this object from database is to use a custom delete HSQL statement? Of course, I can get the persistent object from database and them delete it.
I understand that my approach might be wrong. How would be a good aproach for solving this "problema" since I don't wanna "go" again to the dabase to get the persistent user and them delete him.
I hope I made my self clear.
Regards,
Flavio Matiello