Return-Path: Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: (qmail 18893 invoked from network); 9 Nov 2009 17:09:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 9 Nov 2009 17:09:37 -0000 Received: (qmail 10569 invoked by uid 500); 9 Nov 2009 17:09:36 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 10494 invoked by uid 500); 9 Nov 2009 17:09:36 -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 10484 invoked by uid 99); 9 Nov 2009 17:09:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Nov 2009 17:09:35 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [216.252.110.66] (HELO web55905.mail.re3.yahoo.com) (216.252.110.66) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 09 Nov 2009 17:09:26 +0000 Received: (qmail 91344 invoked by uid 60001); 9 Nov 2009 17:09:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1257786544; bh=5Ro8mQYwHm/YKwmtLb5TMz+Q8ijq1TTBzSFL+/FCs6k=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=yxBuJLJYCoFUopwaXRKLAMXWecUyBcpClULyJ7PgW5NfQQVrHQ1XKt5G/Mo9FtE8SISL1QEzyfgxCgLUZpNew/55OkO0asVCC7WvmjZwXHmj8W9YfAJvxkhIYDro7ytnYnPaLotKcrZEsO9drxyyH7mNo+NfmWh5s+nKWevZEfY= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=UEZ9E1nQ2dX4PUAFQc7ZRBEf1dkMukfjOMiiIPuldSDpFLJonKr/5YDxRLD9BegqMoK5lqOlXwFaJAYmX77gIdD6HKMwRtLer/KfjkwlP/fP691uyvEI8pVbmJeWjqXg0he0oBNEy0wFQ2oyDNHEvMnBT+vxexzhHowmb7Y64EQ=; Message-ID: <892287.91253.qm@web55905.mail.re3.yahoo.com> X-YMail-OSG: NqxmelsVM1novY2PA_8gryzu88LnxwxbhNWhXgLkJ5RcUlb9zaeFU_5JklmQAahrBeGdNK4hdsTOPhIdnj619lQralcIaLh0VNfuyt8HwjyGwEbTrCHWCeZG1OuExDwjUXJ3pPZdWrpZsnWdkugArnDIjn..f8Wf0RBPof36sWCVXo9Ty6U7rLgIZWrtLEaBgJURX_cH1URVePYHsQpSGV4TC_XsmBwE9e6OVfUo7cEeh10yJJiYqz_tzcNsrQKEIEjLG.kEOlMdwdkG1SkYJ.auLy8F8AYWQ8VjonXCmwBy.F3_2dgJeeojJU6hfG5U54Z_6xfFNo8FffuJtdFq.wfUaic979PCTF1bdqE- Received: from [32.97.110.64] by web55905.mail.re3.yahoo.com via HTTP; Mon, 09 Nov 2009 09:09:04 PST X-Mailer: YahooMailRC/211.6 YahooMailWebService/0.7.361.4 References: <4AF6E280.4050309@gmail.com> Date: Mon, 9 Nov 2009 09:09:04 -0800 (PST) From: Fay Wang Subject: Re: Unexpected ArgumentException using 'IN' operator To: users@openjpa.apache.org In-Reply-To: <4AF6E280.4050309@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Checked: Checked by ClamAV on apache.org Hi, I tried the following using openjpa trunk, and it works fine. I will try it using openjpa 1.2. Query q = em.createQuery("Select m from Manager m, IN (m.employees) emps where emps = :emp"); Employee emp = new Employee(); emp.setId(1); q.setParameter("emp", emp); -Fay ----- Original Message ---- From: Vivien Barousse To: users@openjpa.apache.org Sent: Sun, November 8, 2009 7:23:44 AM Subject: Unexpected ArgumentException using 'IN' operator Hi, I'm having trouble using the IN operator in OpenJPA 1.2.1. In my application, I have an entity named 'Entry', which has a many to many relationship to itself on a 'parentEntries' field. Here is the (simplified) code for this entity : @Entity public class Entry implements Serializable { @Id private Long id; @ManyToMany @JoinTable private List parentEntries; /* ... getters and setters ... */ } I'm trying to retrieve all entities which parentEntries contains any given entry (passed as argument to my query). Here is the query: SELECT entry FROM Entry AS entry, IN (entry.parentEntries) AS parent WHERE parent = :entry This query fails on execution, with an ArgumentException : org.apache.openjpa.persistence.ArgumentException: The parameter "entry" is of type "com.aperigeek.jtentative.entity.Entry", but the declaration in the query is for type "java.util.List" at org.apache.openjpa.persistence.QueryImpl.validateParameter(QueryImpl.java:287) at org.apache.openjpa.persistence.QueryImpl.validateParameters(QueryImpl.java:274) at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:248) at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:294) ... This query works fine with other persistence provider (the above code has been successfully tested with Toplink). Am I missing something here? I saw in an old bug report (#OPENJPA-190) someone having the same difficulties. Could this be an OpenJPA bug? Thanks, -- Vivien Barousse