From open-jpa-dev-return-2222-apmail-incubator-open-jpa-dev-archive=incubator.apache.org@incubator.apache.org Fri Feb 16 00:58:10 2007 Return-Path: Delivered-To: apmail-incubator-open-jpa-dev-archive@locus.apache.org Received: (qmail 59069 invoked from network); 16 Feb 2007 00:58:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Feb 2007 00:58:09 -0000 Received: (qmail 11207 invoked by uid 500); 16 Feb 2007 00:58:17 -0000 Delivered-To: apmail-incubator-open-jpa-dev-archive@incubator.apache.org Received: (qmail 11180 invoked by uid 500); 16 Feb 2007 00:58:17 -0000 Mailing-List: contact open-jpa-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: open-jpa-dev@incubator.apache.org Delivered-To: mailing list open-jpa-dev@incubator.apache.org Received: (qmail 11170 invoked by uid 99); 16 Feb 2007 00:58:17 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Feb 2007 16:58:17 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [208.97.132.207] (HELO spaceymail-a1.g.dreamhost.com) (208.97.132.207) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Feb 2007 16:58:05 -0800 Received: from [192.168.15.102] (cpe-76-167-174-30.socal.res.rr.com [76.167.174.30]) by spaceymail-a1.g.dreamhost.com (Postfix) with ESMTP id 01EA3194E5F for ; Thu, 15 Feb 2007 16:57:45 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v752.3) Content-Transfer-Encoding: 7bit Message-Id: <8617DDFA-40F1-4262-9EB9-BA42F46C6040@iq80.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: open-jpa-dev@incubator.apache.org From: Dain Sundstrom Subject: JPA spec wierdism? Date: Thu, 15 Feb 2007 16:57:24 -0800 X-Mailer: Apple Mail (2.752.3) X-Virus-Checked: Checked by ClamAV on apache.org This is the only group of JPA developers, I know of so I'm going to ask here... One thing I find strange is the namespace of NamedQueries. I declare NamedQueries using either an annotation on my entity or in xml using a named-query element nested in my entity element. This implies to me as a developer that the named queries are "owned" by the entity. But when you go to use a named query you must retrieve it using the EntityManager like this: Query query = entityManager.createNamedQuery(name); Which means that the queries have a single global namespace. To make matters worse there doesn't seem to be any enforcement in the schema to make duplicate queries illegal. Is my understanding correct? Also, OpenJPA seems to be ok with duplicate query names and randomly pick which one to execute. I think we should at least print a warning if a user has duplicate named queries, or maybe fire an exception for duplicate names. -dain