Return-Path: Delivered-To: apmail-db-jdo-dev-archive@www.apache.org Received: (qmail 72225 invoked from network); 13 Sep 2010 01:20:02 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 13 Sep 2010 01:20:02 -0000 Received: (qmail 89675 invoked by uid 500); 13 Sep 2010 01:20:02 -0000 Mailing-List: contact jdo-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jdo-dev@db.apache.org Delivered-To: mailing list jdo-dev@db.apache.org Received: (qmail 89667 invoked by uid 99); 13 Sep 2010 01:20:02 -0000 Received: from Unknown (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Sep 2010 01:20:02 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [148.87.113.121] (HELO rcsinet10.oracle.com) (148.87.113.121) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Sep 2010 01:19:37 +0000 Received: from rcsinet15.oracle.com (rcsinet15.oracle.com [148.87.113.117]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o8D1JFd8004714 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 13 Sep 2010 01:19:16 GMT Received: from acsmt353.oracle.com (acsmt353.oracle.com [141.146.40.153]) by rcsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o8D1JE3I003741 for ; Mon, 13 Sep 2010 01:19:15 GMT Received: from abhmt013.oracle.com by acsmt353.oracle.com with ESMTP id 598360221284340733; Sun, 12 Sep 2010 18:18:53 -0700 Received: from [192.168.100.128] (/173.13.116.145) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 12 Sep 2010 18:18:53 -0700 Message-Id: <086537C3-C19F-4722-ABEB-E81F999CD353@oracle.com> From: Craig L Russell To: jdo-dev@db.apache.org In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Subject: Re: getObjectsById Mime-Version: 1.0 (Apple Message framework v936) Date: Sun, 12 Sep 2010 18:18:50 -0700 References: X-Mailer: Apple Mail (2.936) X-Virus-Checked: Checked by ClamAV on apache.org Hi Erik, On Sep 12, 2010, at 4:14 AM, Erik Bengtson wrote: > Hi, > > I was wondering the behaviour of getObjectsById operatiob upon > different argument values. > > 1st) getObjectsById(Collections.EMPTY_SET), the user has not done any > invalid operation on the interface, thus it should just return another > empty collection. Currently, Datanucleus raises an exception. Should return Collections.EMPTY_SET > > 2nd) when getObjectsById(null) is invoked, it raises a > JDOUserException. Good. A null instance is not an empty collection. > > 3rd) getObjectsById(Object... oids) where oids == null, it raises a > JDOUserException. Good. A null array is not an instance of Object[0]. > > 4th) getObjectsById(Object... oids) where one of the id elements is > null, it raises a JDOUserException. This is consistent with 12.6.5 which states "If the PersistenceManager is unable to resolve the oid parameter to an ObjectId instance, then it throws a JDOUserException. " The issue that isn't documented is how to tell the user which of the elements is bad. If we use 17.1 as a model, "Methods are provided to retrieve the nested exception array and failed object. If there are multiple nested exceptions, then each might contain one failed object. This will be the case where an operation requires multiple instances, such as commit, makePersistentAll, etc." then there should be an exception thrown that contains multiple nested exceptions, each of which describes the problem with one of the object ids. > or > getObjectsById(Collections.EMPTY_SET), where one of the id elements is > null, it raises a JDOUserException. > Collections.EMPTY_SET is already discussed above. If you mean a collection (List) one or more of whose elements are null, then a JDOUserException should be raised, similar to above. Craig > > Any thoughts? > > Erik Craig L Russell Architect, Oracle http://db.apache.org/jdo 408 276-5638 mailto:Craig.Russell@oracle.com P.S. A good JDO? O, Gasp!