Milan,

Please read the EntityManager JavaDoc at http://java.sun.com/javaee/5/docs/api/javax/persistence/EntityManager.html and http://www.oracle.com/technology/pub/articles/gupta-jpa.html You'll see these explain why you can't simply put the object into a session and keep using it.

You need to store the ID in the web page, refetch the object, then update with the data posted from the form whilst ensuring your security constraints are not violated.

Al.


Milan Milanovic wrote:
Yes, EntityManager will be closed, but it always closes whenevery you do
something (read/write) your object from database, isn't it ? When I read for
example Fruit (id=1) from database, change it and try to save it will know
with new EntityManager instance to save it because of id number ?

--
Thx, Milan


Al Sutton wrote:
If you're using a persistence framework (Hibernate, JPA, etc.) then No.

During after the first request the EntityManager will be closed, so when you access it during the second request updates will not be propagated to the database.

Al.

Milan Milanovic wrote:
But could I pass object through session object ?


newton.dave wrote:
--- On Fri, 6/13/08, Milan Milanovic <[EMAIL PROTECTED]> wrote:
Yes that's what I want. The first action search in database and show
the list of Fruits. Then user click on one and that concrete Fruit object
is
passed to other action for editing.
All you can pass in an HTTP request is a string.

You can *use* that string to create or retrieve an object.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to