Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 84461 invoked from network); 6 Dec 2010 19:07:32 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 6 Dec 2010 19:07:32 -0000 Received: (qmail 71249 invoked by uid 500); 6 Dec 2010 19:07:32 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 71099 invoked by uid 500); 6 Dec 2010 19:07:32 -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 71091 invoked by uid 99); 6 Dec 2010 19:07:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Dec 2010 19:07:31 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Dec 2010 19:07:30 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id oB6J7AGM003533 for ; Mon, 6 Dec 2010 19:07:10 GMT Message-ID: <2684396.2621291662430322.JavaMail.jira@thor> Date: Mon, 6 Dec 2010 14:07:10 -0500 (EST) From: "Dominik Stadler (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Created: (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 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 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. - You can reply to this email to add a comment to the issue online.