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 Martin Zaun <Ma...@Sun.COM> on 2005/09/30 11:28:32 UTC

queries and class registration issue [was: Re: status update: ri11 enhancer support for jdk 1.5]

Craig,

here's a summary of the discussion Michael and I had on the issue of
"queries and class registration" (as exposed by the 1.5 jvm).  Please,
review and comment on our assumptions and solution approach.

1. JDO requires the application to register the "target" class and
    relevant subclasses (!) before executing a polymorphic query,
    navigation, getExtent (with subclasses), or getObjectById.

    Now, at least this is what I think to remember from JDO1: Some JDO
    implementations have no means to know the "class universe", i.e.,
    all subclasses of a class or the PC class for an Oid class.  So,
    the getExtent method and queries are executed based on the set of
    PC classes currently known to the runtime.  This requires the
    application to register (load+initialize) the relevant classes
    before the above methods and queries are being used.

    However, I couldn't find that provision in the jdo-2005-09-09.pdf
    spec document (we grepped for a number of keywords).

    Have I overlooked something or has this requirement upon the
    application been dropped in the JDO2 spec?

2. On the other hand, a JDO implementation may actively load and
    initialize PC classes.

    Section 12.5 (Class Loaders) states explicitly:

      JDO requires access to class instances in several situations
      where the class instance is not provided explicitly. In these
      cases, the only information available to the implementation is
      the name of the class.  To resolve class names to class
      instances, JDO implementations will use
        Class.forName(String name, boolean initialize, ClassLoader loader)
      with up to three loaders. The initialize parameter can be
      either true or false depending on the implementation.

    So, in general, the user must be aware that a JDO implementation
    may load and initialize classes, that is, execute static
    initializers, in a sometimes, perhaps, unexpected order.

3. For classes/types used in queries, such as in navigational
    expressions ("a.b.c"), the question arises if the application
    is responsible for having them loaded before query compilation
    or execution, or if a JDO implementation may load and initialize
    them when compiling or executing a query.

    I think it's OK for a JDO implementation to initialize those
    classes, since this results from them being used in a query, that
    is, the user has given a hint to use these classes.

    This is the approach Michael has implemented, which solves the
    JVM 1.5 class registration issue.

 From a hotspot at London Heathrow,
Martin