You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by Erik Bengtson <er...@jpox.org> on 2010/09/12 13:14:30 UTC

getObjectsById

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.

2nd) when getObjectsById(null) is invoked, it raises a JDOUserException.

3rd) getObjectsById(Object... oids) where oids == null, it raises a
JDOUserException.

4th) getObjectsById(Object... oids) or
getObjectsById(Collections.EMPTY_SET), where one of the id elements is
null, it raises a JDOUserException.


Any thoughts?

Erik

Filters

Posted by Renato Garcia <re...@gmail.com>.
  Is there currently any functionality similar to Hibernate filters 
<http://docs.jboss.org/hibernate/core/3.3/reference/en/html/filters.html> in 
JDO?

We've been using this to implement data separation such as Chinese wall 
<http://en.wikipedia.org/wiki/Chinese_wall> and has been proved to be a 
very clean and efficient way to achieve this. Now we to do the same 
thing but using JDO. Any thoughts?

Thanks in advance!

Re: getObjectsById

Posted by Craig L Russell <cr...@oracle.com>.
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!