Hello Craig,
that sounds good to me. In my case, it was ids originally obtained using
JDOHelper for persistent PersistenceCapable instances. Those ids should
then be constructed with "exactClass==true" by the implementation. In
effect, the application programmer here wouldn't have to worry at all
about them being exact or not, since the implementation itself creates
the ids that it later on consumes in getObjectById().
Regards,
Jörg
Craig L Russell wrote:
Hi Jörg,
On Jul 22, 2008, at 8:13 AM, Joerg von Frantzius wrote:
Hi,
when calling PersistenceManager.getObjectById() with a
SingleFieldIdentity, there seems to be no way of avoiding the
following (if the implementation decides to do so):
"It is an implementation decision whether to access the data store,
if required to determine the exact class. This will be the case of
inheritance, where multiple <code>PersistenceCapable</code> classes
share the same ObjectId class."
Now when I know for sure that the targetClassName of the given
SingleFieldIdentity already denotes the correct class for the given
id, how can I avoid that additional roundtrip to the database for
finding the exact class?
The behavior of getObjectById might better be determined by the object
id itself instead of the programmer having to know whether the class
is the exact class.
Maybe we should look at another constructor for the
SingleFieldIdentity classes that embeds the knowledge that the class
name is exact? That way, the jdo implementation could construct
identity instances and the user could also construct identity
instances that represent the exact class.
WDYT?
Craig
Maybe it would be useful to have another
Object getObjectById (Object oid, boolean validate, boolean
determineExactClassInDatastore);
on PersistenceManager for that purpose?
Regards,
Jörg
--
____________________________________________________________________
artnology GmbH - Milastraße 4 - 10437 Berlin - Germany
Geschäftsführer: Ekkehard Blome (CEO), Felix Kuschnick (CCO)
Registergericht: Amtsgericht Berlin Charlottenburg HRB 76376 UST-Id.
DE 217652550
Craig L Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!
--
____________________________________________________________________
artnology GmbH - Milastraße 4 - 10437 Berlin - Germany
Geschäftsführer: Ekkehard Blome (CEO), Felix Kuschnick (CCO)
Registergericht: Amtsgericht Berlin Charlottenburg HRB 76376
UST-Id. DE 217652550