From dev-return-20083-apmail-openjpa-dev-archive=openjpa.apache.org@openjpa.apache.org Fri Feb 3 19:30:17 2012 Return-Path: X-Original-To: apmail-openjpa-dev-archive@www.apache.org Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9350C9F85 for ; Fri, 3 Feb 2012 19:30:17 +0000 (UTC) Received: (qmail 84203 invoked by uid 500); 3 Feb 2012 19:30:17 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 84098 invoked by uid 500); 3 Feb 2012 19:30:16 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 84070 invoked by uid 99); 3 Feb 2012 19:30:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Feb 2012 19:30:15 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Feb 2012 19:30:14 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 7184E18B01F for ; Fri, 3 Feb 2012 19:29:54 +0000 (UTC) Date: Fri, 3 Feb 2012 19:29:54 +0000 (UTC) From: "Albert Lee (Resolved) (JIRA)" To: dev@openjpa.apache.org Message-ID: <150364887.8625.1328297394466.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <2684396.2621291662430322.JavaMail.jira@thor> Subject: [jira] [Resolved] (OPENJPA-1903) Some queries only work the first time they are executed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/OPENJPA-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Albert Lee resolved OPENJPA-1903. --------------------------------- Resolution: Fixed Confirmed with Pinaki, this issues is completed and can be closed. > Some queries only work the first time they are executed > ------------------------------------------------------- > > Key: OPENJPA-1903 > URL: https://issues.apache.org/jira/browse/OPENJPA-1903 > Project: OpenJPA > Issue Type: Bug > Components: query > Affects Versions: 2.0.1 > Reporter: Dominik Stadler > Assignee: Pinaki Poddar > Fix For: 2.2.0 > > > I have a problem in my application where a query that sometimes returns data and sometimes not. > I have reduced it to the code as much as I could into an Eclipse project available at http://ubuntuone.com/p/S9n/ > This happens with OpenJPA 2.0.1 as well as the daily snapshot from 2010-12-05 and an out-of-process Derby database. > Basically I have two Entities which both use multiple Ids to produce the Primary Key, "Preis" contains a foreign key on "Website": > @Entity > @IdClass(MandantAndNameIdentity.class) > public class Website { > @Id > private String mandant; > > @Id > private String name; > ... > } > @Entity > @IdClass(WebsiteProduktDatumIdentity.class) > public class Preis { > @Id > @ManyToOne(cascade = CascadeType.MERGE) > private Website website; > @Id > @Basic > private String datum; > ... > } > I use the following to set up a website and a Preis: > em.getTransaction().begin(); > Website website = em.merge(new Website("Mandant", "Website")); > em.merge(new Preis(website, DATUM)); > > em.getTransaction().commit(); > Afterwards, if I run the query as follows: > TypedQuery q = em.createQuery( > "select m from Preis m " + > "where m.website.name = :website ", Preis.class); > q.setParameter("website", website.getName()); > this query works all the time, note that it uses website.name for matching, not the full Website-object. > However if I put the query as > TypedQuery q = em.createQuery( > "select m from Preis m " + > "where m.website = :website ", Preis.class); > q.setParameter("website", website); > it only works ONCE and then does not return any results any more!! See testcase DataAccessVerifyTest for details. > Discussion on the mailinglist seems to indicate that this is a bug. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira