commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Abbas Adel" <b...@tantawi.net>
Subject RE: Update problems with hibernate & struts
Date Sun, 25 Feb 2007 19:23:02 GMT
Can you provide us with modeldao.update(); code 

-----Original Message-----
From: Guoxue Zhang [mailto:zguoxue@yahoo.com] 
Sent: Sunday, February 25, 2007 8:20 PM
To: Jakarta Commons Users List
Subject: Update problems with hibernate & struts

Hello Guys,
   
  When I update a record using Hibernate and Struts, I have to transfer
primary key(type is LONG) to ModelUpdadteAction class  from update.jsp file.

   
  In ModelUpdateAction.java file: 
   
  String v_id = request.getParameter("modelid");
  Long v_idLong = Long.valueOf( v_id);
  
  Models model = new Models();
  model.setModelId(v_idLong);
  model.setModelname("Update New record IN Models");
   
  ModelsDAO modeldao = new ModelsDAO();
  modeldao.update(model);
   
  I cann't update the record.  A error is: javax.servlet.ServletException: a
different object with the same identifier value was already associated with
the session:
   
  If I directly update with a primary key: 
   
  Long v_idLong = Long.valueOf( "55");
  
  Models model = new Models();
  model.setModelId(v_idLong);
  model.setModelname("Update New record IN Models");
   
  ModelsDAO modeldao = new ModelsDAO();
  modeldao.update(model);
   
  It is successful.
   
  Please reply that is what is problem and how to solv it. Thank you.
   
  Frank
   
   
   
   
  
  
 
   

 
---------------------------------
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.


__________ NOD32 2080 (20070225) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message