Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 71729 invoked from network); 1 Oct 2007 21:39:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Oct 2007 21:39:36 -0000 Received: (qmail 44114 invoked by uid 500); 1 Oct 2007 21:39:17 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 44093 invoked by uid 500); 1 Oct 2007 21:39:17 -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 44082 invoked by uid 99); 1 Oct 2007 21:39:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Oct 2007 14:39:17 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [88.198.241.90] (HELO web.cuetech.de) (88.198.241.90) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Oct 2007 21:39:18 +0000 Received: from [192.168.10.127] (mnch-4db1ea32.pool.einsundeins.de [77.177.234.50]) by web.cuetech.de (Postfix) with ESMTP id 108FB3C036550 for ; Mon, 1 Oct 2007 23:38:54 +0200 (CEST) From: Piero Sartini To: "Struts Users Mailing List" Subject: Re: ModelDriven CRUD validation failure still causes JPA update Date: Mon, 1 Oct 2007 23:38:20 +0200 User-Agent: KMail/1.9.7 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200710012338.20471.lists@pierosartini.de> X-Virus-Checked: Checked by ClamAV on apache.org > Since my Model is acquired from the Hibernate session (during the > "prepare()" Action method), it is a transactional persistent instance. > Note this from the hibernate documentation: > > "Transactional persistent instances (ie. objects loaded, saved, created or > queried by the Session) may be manipulated by the application and any > changes to persistent state will be persisted when the Session is flushed > (discussed later in this chapter). There is no need to call a particular > method (like update(), which has a different purpose) to make your > modifications persistent." I do not know hibernate but you could try the following solutions: * don't flush the session and destroy the object * instantiate a temporary bean used for the form only: BeanUtils.copyProperties(tempBean, yourBean); * manage your entities with JPA's EntityManager, merge them manually. Piero --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org