db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Bouschen <mbo.t...@spree.de>
Subject Re: Please review this patch for PersistenceCapable, FetchPlan, JDOImplHelper
Date Tue, 13 Sep 2005 08:17:03 GMT
Hi Craig,

another remark about FetchPlan.java: there is a typo in the javadoc for 
the static fields DETACH_UNLOAD_FIELDS and DETACH_LOAD_FIELDS. They 
should link to the PM method detachCopy instead of detach.

Regards Michael

> Hi Craig,
> 
> here are my comments.
> 
> PersistenceCapable and JDOImplHelper:
> 
> - The javadoc uses class ObjectIdFieldProvider instead of
> ObjectIdFieldSupplier.
> - You might want to enclose the type Character in <code></code>.
> - The javadoc includes Character in the list of types for which the
> behavious is specified (because Character does not extend Number).
> The spec just mentions Number, ObjectIdFieldSupplier and String, but not
> Character (see section 7.12 JDO identity handling on page 78 of the PFD
> version of the spec).
> 
> FetchPlan:
> 
> - Minor: please add a newline at the end of the file.
> 
> Regards Michael
> 
> 
>> Javadogs,
>>
>> I've updated the javadoc for PersistenceCapable and JDOImplHelper; and 
>> removed obsolete constants and added missing constants and methods to 
>> FetchPlan.
>>
>> Please take a look.
>>
>> Thanks,
>>
>> Craig
>>
>>
>> ------------------------------------------------------------------------
>>
>> Index: src/java/javax/jdo/FetchPlan.java
>> ===================================================================
>> --- src/java/javax/jdo/FetchPlan.java    (revision 231530)
>> +++ src/java/javax/jdo/FetchPlan.java    (working copy)
>> @@ -55,19 +55,22 @@
>>      public static final String ALL = "all";
>>  
>>      /**
>> -     * For use with {@link #addGroup}, {@link #removeGroup}, and the
>> -     * various {@link #setGroups} calls. Value: <code>values</code>.
>> +     * For use with {@link PersistenceManager#detach} and
>> +     * {@link #setDetachmentOptions}. Specifies that
>> +     * fields that are loaded but not in the current fetch plan should
>> +     * be unloaded prior to detachment.
>>       * @since 2.0
>>       */
>> -    public static final String VALUES = "values";
>> +    public static final int DETACH_UNLOAD_FIELDS = 2;
>>  
>>      /**
>> -     * For use with {@link #addGroup}, {@link #removeGroup}, and the
>> -     * various {@link #setGroups} calls. Value: <code>none</code>.
>> -     * ### this is not mentioned in 12.7.2. It is referred to in 
>> 12.7's text.
>> +     * For use with {@link PersistenceManager#detach} and
>> +     * {@link #setDetachmentOptions}. Specifies that
>> +     * fields that are not loaded but are in the current fetch plan 
>> should
>> +     * be loaded prior to detachment.
>>       * @since 2.0
>>       */
>> -    public static final String NONE = "none";
>> +    public static final int DETACH_LOAD_FIELDS = 1;
>>  
>>      /**
>>       * For use with {@link #setFetchSize}. Value: -1.
>> @@ -151,4 +154,15 @@
>>       * @since 2.0
>>       */
>>      int getFetchSize(); +    +    /**
>> +     * Set options to be used during detachment. Options are {@link
>> +     * #DETACH_LOAD_FIELDS} and {@link #DETACH_UNLOAD_FIELDS}.
>> +     */
>> +    FetchPlan setDetachmentOptions(int options);
>> +    +    /**
>> +     * Get options used during detachment.
>> +     */
>> +    int getDetachmentOptions();
>>  }
>> \ No newline at end of file
>> Index: src/java/javax/jdo/spi/PersistenceCapable.java
>> ===================================================================
>> --- src/java/javax/jdo/spi/PersistenceCapable.java    (revision 231530)
>> +++ src/java/javax/jdo/spi/PersistenceCapable.java    (working copy)
>> @@ -351,22 +351,24 @@
>>      Object jdoNewObjectIdInstance();
>>           /** Create a new instance of the class used for JDO 
>> identity, using the
>> -     * key constructor of the object id class. It is intended only 
>> for single
>> +     * key constructor of the object id class. It is intended for single
>>       * field identity. The identity
>>       * instance returned has no relationship with the values of the 
>> primary key
>>       * fields of the persistence-capable instance on which the method 
>> is called.
>>       * If the key is the wrong class for the object id class, null is 
>> returned.
>>       * <P>For classes that use single field identity, if the 
>> parameter is of one       * of the following types, the behavior must 
>> be as specified:
>> -     * <ul><li><code>Number</code>: the numeric value of
the proper 
>> type -     * is extracted from
>> -     * the parameter and passed to the single field identity constructor
>> +     * <ul><li><code>Number</code>: the  parameter must
be the single 
>> field
>> +     * type or the wrapper class of a primitive field type; the 
>> parameter
>> +     * is passed to the single field identity constructor
>>       * </li><li><code>ObjectIdFieldProvider</code>: the
numeric value 
>> -     * of the proper type
>> +     * of the proper type or the wrapper value (for wrapper field types)
>>       * is fetched from the <code>ObjectIdFieldProvider</code> and 
>> passed to the       * single field identity constructor
>>       * </li><li><code>String</code>: the String is passed
to the 
>>       * single field identity constructor
>> +     * </li><li>Character: the Character
>> +     * is passed to the CharIdentity constructor.
>>       * </li></ul>
>>       * @return the new instance created.
>>       * @param o the object identity constructor parameter
>> Index: src/java/javax/jdo/spi/JDOImplHelper.java
>> ===================================================================
>> --- src/java/javax/jdo/spi/JDOImplHelper.java    (revision 231530)
>> +++ src/java/javax/jdo/spi/JDOImplHelper.java    (working copy)
>> @@ -201,8 +201,15 @@
>>           /** Create a new instance of the ObjectId class of this
>>       * <code>PersistenceCapable</code> class.
>> +     * It is intended only for application identity. This method should
>> +     * not be called for classes that use single field identity;
>> +     * newObjectIdInstance(Class, Object) should be used instead. 
>> +     * If the class has been +     * enhanced for datastore identity, 
>> or if the class is abstract, +     * null is returned.
>>       * @param pcClass the <code>PersistenceCapable</code> class.
>> -     * @return the new ObjectId instance, or <code>null</code> if the

>> class is not registered.
>> +     * @return the new ObjectId instance, or <code>null</code> if the

>> class +     * is not registered.
>>       */         public Object newObjectIdInstance (Class pcClass) {
>>          Meta meta = getMeta (pcClass);
>> @@ -212,6 +219,21 @@
>>           /** Create a new instance of the ObjectId class of this 
>> <code>PersistenceCapable</code>
>>       * class, using the <code>Object</code> form of the constructor.
>> +     * If the key is the wrong class for the object id class, null is 
>> returned.
>> +     * <P>For classes that use single field identity, if the 
>> parameter is of one +     * of the following types, the behavior must 
>> be as specified:
>> +     * <ul><li><code>Number</code>: the  parameter must
be the single 
>> field
>> +     * type or the wrapper class of a primitive field type; the 
>> parameter
>> +     * is passed to the single field identity constructor
>> +     * </li><li><code>ObjectIdFieldProvider</code>: the
numeric value 
>> +     * of the proper type or the wrapper value (for wrapper field types)
>> +     * is fetched from the <code>ObjectIdFieldProvider</code> and 
>> passed to the +     * single field identity constructor
>> +     * </li><li><code>String</code>: the String is passed
to the 
>> +     * single field identity constructor
>> +     * </li><li>Character: the Character
>> +     * is passed to the CharIdentity constructor.
>> +     * </li></ul>
>>       * @return the new ObjectId instance, or <code>null</code> if the

>> class is not registered.
>>       * @param obj the <code>Object</code> form of the object id
>>       * @param pcClass the <code>PersistenceCapable</code> class.
>>
>>
>> ------------------------------------------------------------------------
>>
>>
>> Craig Russell
>>
>> Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
>>
>> 408 276-5638 mailto:Craig.Russell@sun.com
>>
>> P.S. A good JDO? O, Gasp!
>>
>>
> 
> 


-- 
Michael Bouschen		Tech@Spree Engineering GmbH
mailto:mbo.tech@spree.de	http://www.tech.spree.de/
Tel.:++49/30/235 520-33		Buelowstr. 66			
Fax.:++49/30/2175 2012		D-10783 Berlin			

Mime
View raw message