Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 52437 invoked from network); 13 Jun 2008 17:13:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Jun 2008 17:13:35 -0000 Received: (qmail 41375 invoked by uid 500); 13 Jun 2008 17:13:29 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 41350 invoked by uid 500); 13 Jun 2008 17:13:29 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 41339 invoked by uid 99); 13 Jun 2008 17:13:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Jun 2008 10:13:29 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [212.23.3.142] (HELO smarthost03.mail.zen.net.uk) (212.23.3.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Jun 2008 17:12:37 +0000 Received: from 82-70-203-134.dsl.in-addr.zen.co.uk ([82.70.203.134] helo=[127.0.0.1]) by smarthost03.mail.zen.net.uk with esmtp (Exim 4.63) (envelope-from ) id 1K7Cpa-0000LP-3b for user@struts.apache.org; Fri, 13 Jun 2008 17:12:54 +0000 Message-ID: <4852AA90.5040409@alsutton.com> Date: Fri, 13 Jun 2008 18:12:48 +0100 From: Al Sutton User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: Struts Users Mailing List Subject: [OT] Re: [JPA more than Struts 2] Two action classes ? References: <17824236.post@talk.nabble.com> <162923.18761.qm@web56715.mail.re3.yahoo.com> <17825719.post@talk.nabble.com> <172461.34299.qm@web56702.mail.re3.yahoo.com> <17826614.post@talk.nabble.com> <401459.30363.qm@web56706.mail.re3.yahoo.com> <17827033.post@talk.nabble.com> <4852A283.5060706@alsutton.com> <17827920.post@talk.nabble.com> In-Reply-To: <17827920.post@talk.nabble.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Originating-Smarthost03-IP: [82.70.203.134] X-Virus-Checked: Checked by ClamAV on apache.org 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 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: user-unsubscribe@struts.apache.org >>>> For additional commands, e-mail: user-help@struts.apache.org >>>> >>>> >>>> >>>> >>>> >>> >>> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org >> For additional commands, e-mail: user-help@struts.apache.org >> >> >> >> > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org