Return-Path: Delivered-To: apmail-openjpa-users-archive@locus.apache.org Received: (qmail 47536 invoked from network); 30 Sep 2008 21:12:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Sep 2008 21:12:30 -0000 Received: (qmail 33041 invoked by uid 500); 30 Sep 2008 21:12:28 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 33013 invoked by uid 500); 30 Sep 2008 21:12:28 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 33002 invoked by uid 99); 30 Sep 2008 21:12:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Sep 2008 14:12:28 -0700 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of kwsutter@gmail.com designates 209.85.217.21 as permitted sender) Received: from [209.85.217.21] (HELO mail-gx0-f21.google.com) (209.85.217.21) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Sep 2008 21:11:25 +0000 Received: by gxk14 with SMTP id 14so11988408gxk.9 for ; Tue, 30 Sep 2008 14:11:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type:references; bh=ozap8M9WaIGXK2m/YlwhCe50qP4wEXVGgGN0yWBDGDU=; b=EBFysvI2Rk9+PKMVTQK4QfCFcqCk76WVdQChfXk0MLWBSEgaT85xi+RQNRqjtiUxf8 lhW1lBgsiy+0yuBscpsvKAHYDK8aOsK3rz7Yz25W6i22dO43mbFJjMdX8Mk4vLe56XfN qnsQNdrCBBty+AHO80KX74VDiUV4mRqeHT8ko= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=WRBRYa90gtJe4CggIYfgbFCkO80fTkuy6LMovOFSmb6YXP3Uz8qWGmFQu4nIkpqco7 boVOa6RUqO4bzIbu6IZis1NqAuYwqzCbDlZit/fvTDjQVUXovl7aF51J++UOZxf0H7iC CC+VXatuU4CNW26gN7c3u9ZcSE6LCEMkJG7Xc= Received: by 10.142.237.20 with SMTP id k20mr3046461wfh.146.1222809118573; Tue, 30 Sep 2008 14:11:58 -0700 (PDT) Received: by 10.142.144.1 with HTTP; Tue, 30 Sep 2008 14:11:58 -0700 (PDT) Message-ID: <89c0c52c0809301411v48d620e6o8b986cbef3bfb58@mail.gmail.com> Date: Tue, 30 Sep 2008 16:11:58 -0500 From: "Kevin Sutter" To: users@openjpa.apache.org Subject: Re: UPDATE is called when only SELECT is expected In-Reply-To: <20080930215012.13b6ad76.sergej@beworx.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_14777_1186347.1222809118567" References: <20080930215012.13b6ad76.sergej@beworx.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_14777_1186347.1222809118567 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I believe this issue is already being discussed on this forum: http://n2.nabble.com/Non-dirty-entity-version-field-update-SUPER-URGENT!!!-td1120307.html#a1129303 Please join that discussion with any additional insights. Thanks, Kevin On Tue, Sep 30, 2008 at 2:50 PM, Sergej Shafarenka wrote: > Hey Guys! > > I use OpenJPA in tandem with SpringFramework. I wrote a simple application > which reads some data from MySQL database and faced very weird problem: > openjpa executes an "update" statement when only "select" query is used and > no object modifications are done. > > // My service's method looks like this one > @Transactional(readOnly=true) > public void test(String user) { > Query query = m_entityManager.createQuery("select u from User u"); > List users = (List) query.getResultList(); > for (User u : users) { > if (u.getLoginName().equals(user)) { > System.out.println("Bingo!"); > } > } > } > > // User class is very simple > @Entity > @Table(name="user") > public class User implements Serializable { > @Id > @Column(name="user_id") > private int m_id; > > @Column(name="user_login_name") > private String m_loginName; > > // getters and setters are omitted as not essential for problem > understanding > } > > // and openjpa's log-output looks like the one below > openjpa.jdbc.SQL - executing prepstmnt 16900472 > SELECT t0.user_id, t0.user_login_name from t0 > openjpa.jdbc.SQL - [0 ms] spent > // and this is the problem :((( > openjpa.jdbc.SQL - executing prepstmnt 25980092 > UPDATE user SET user_login_name = ? WHERE user_id = ? [params=(String) test, > (int) 1] > openjpa.jdbc.SQL - [0 ms] spent > > > It is already three days I spent on fixing the problem with no success :( > Would someone help me please. I am even ready to switch off automatic update > functionality if there were such possibility. > > Thanks and best regards, > Sergej > ------=_Part_14777_1186347.1222809118567--