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 Michael Bouschen <mb...@spree.de> on 2005/06/26 22:55:25 UTC
Another api20 change
Hi,
attached you find some changes of the api20 project. It adds method
isDetached to the StateManager interface and add since tags to two PM
methods.
Regards Michael
--
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
Re: Another api20 change
Posted by Michael Bouschen <mb...@spree.de>.
Hi Andy,
good question! I will not check in the StateManager changes before this
has been resolved. I hope that Craig can clarify.
Regards Michael
>>this is just for JDO implementations that decide to keep the
>>StateManager for detached instances. The enhancer generated code for
>>jdoIsDetached needs to check whether there is a StateManager anyway. If
>>so it should delegate to it, if not it should check for the objectId.
>>What do you think?
>
>
> Hi Michael,
>
> Well I've no particular problem with the idea, but I seem to have missed the
> discussion in the EG that we are even allowing StateManagers for detached
> instances.
>
>
> Some time back when we were discussing serialisation of detacheds I seem to
> remember that it was decided not to have this. Maybe I misunderstood what was
> being discussed.
>
> What happens if someone passes a detached instance (that has no SM) across to
> a JDO impl that needs a SM while detached ? What is the detached SM doing ?
> (presumably keeping some track of what fields have changed - even though we
> already have these fields stored in the BitSet).
> What if JDO Impl 1 requires a StateManager while detached, and then the
> detached instance is serialised. It is then passed to another app server and
> the user tries to deserialise it. It is presumably going to try to
> deserialise the SM, but JDO Impl1 classes aren't present on this app server.
>
> If a detached instance can sometimes have a StateManager (dependent on the
> implementation) then the spec should state that it is for the implementation
> to decide whether to use them whilst detached. I don't see this currently.
>
>
--
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
Re: Another api20 change
Posted by Andy Jefferson <an...@jpox.org>.
> this is just for JDO implementations that decide to keep the
> StateManager for detached instances. The enhancer generated code for
> jdoIsDetached needs to check whether there is a StateManager anyway. If
> so it should delegate to it, if not it should check for the objectId.
> What do you think?
Hi Michael,
Well I've no particular problem with the idea, but I seem to have missed the
discussion in the EG that we are even allowing StateManagers for detached
instances.
Some time back when we were discussing serialisation of detacheds I seem to
remember that it was decided not to have this. Maybe I misunderstood what was
being discussed.
What happens if someone passes a detached instance (that has no SM) across to
a JDO impl that needs a SM while detached ? What is the detached SM doing ?
(presumably keeping some track of what fields have changed - even though we
already have these fields stored in the BitSet).
What if JDO Impl 1 requires a StateManager while detached, and then the
detached instance is serialised. It is then passed to another app server and
the user tries to deserialise it. It is presumably going to try to
deserialise the SM, but JDO Impl1 classes aren't present on this app server.
If a detached instance can sometimes have a StateManager (dependent on the
implementation) then the spec should state that it is for the implementation
to decide whether to use them whilst detached. I don't see this currently.
--
Andy
Java Persistent Objects - JPOX
Re: Another api20 change
Posted by Michael Bouschen <mb...@spree.de>.
Hi Andy,
this is just for JDO implementations that decide to keep the
StateManager for detached instances. The enhancer generated code for
jdoIsDetached needs to check whether there is a StateManager anyway. If
so it should delegate to it, if not it should check for the objectId.
What do you think?
Regards Michael
>>when an object is detached it doesn't have a StateManager, hence the
>>jdoIsDirty() method added to PC instances during enhancement is typically
>>based on whether it has an objectId and state manager in the instance.
>>Hence my question is, why do we need this method ?
>
>
> I did of course mean to say "the jdoIsDetached() method".
>
--
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
Re: Another api20 change
Posted by Andy Jefferson <an...@jpox.org>.
> when an object is detached it doesn't have a StateManager, hence the
> jdoIsDirty() method added to PC instances during enhancement is typically
> based on whether it has an objectId and state manager in the instance.
> Hence my question is, why do we need this method ?
I did of course mean to say "the jdoIsDetached() method".
--
Andy
Java Persistent Objects - JPOX
Re: Another api20 change
Posted by Andy Jefferson <an...@jpox.org>.
> attached you find some changes of the api20 project. It adds method
> isDetached to the StateManager interface and add since tags to two PM
> methods.
Hi Michael,
when an object is detached it doesn't have a StateManager, hence the
jdoIsDirty() method added to PC instances during enhancement is typically
based on whether it has an objectId and state manager in the instance. Hence
my question is, why do we need this method ?
--
Andy
Java Persistent Objects - JPOX
Re: Another api20 change
Posted by Michael Bouschen <mb...@spree.de>.
Hi Craig,
thanks!
One more question: does the enhancer generated method jdoGetVersion
delegate to the StateManager? I think it should, so I propose I add the
following method to the StateManager:
/** Return the object representing the version of the calling instance.
* @param pc the calling <code>PersistenceCapable</code> instance
* @return the object representing the version of the calling instance.
*/
Object getVersion (PersistenceCapable pc);
What do you think?
Regards Michael
> Hi Michael,
>
> Looks good to check in.
>
> Craig
>
> On Jun 26, 2005, at 1:55 PM, Michael Bouschen wrote:
>
>> Hi,
>>
>> attached you find some changes of the api20 project. It adds method
>> isDetached to the StateManager interface and add since tags to two PM
>> methods.
>>
>> Regards Michael
>>
>> --
>> 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
>>
>> Index: src/java/javax/jdo/spi/StateManager.java
>> ===================================================================
>> --- src/java/javax/jdo/spi/StateManager.java (revision 201765)
>> +++ src/java/javax/jdo/spi/StateManager.java (working copy)
>> @@ -119,6 +119,17 @@
>> * in the current transaction.
>> */
>> boolean isDeleted(PersistenceCapable pc);
>> +
>> + /** Tests whether this object has been detached.
>> + *
>> + * Instances that have been detached return <code>true</code>.
>> + *
>> + *<P>Transient instances return <code>false</code>.
>> + *<P>
>> + * @see PersistenceManager#detachCopy(Object pc)
>> + * @param pc the calling <code>PersistenceCapable</code> instance
>> + * @return <code>true</code> if this instance was detached.
>> + boolean isDetached(PersistenceCapable pc);
>>
>> /** Return the <code>PersistenceManager</code> that owns this
>> instance.
>> * @param pc the calling <code>PersistenceCapable</code> instance
>> Index: src/java/javax/jdo/PersistenceManager.java
>> ===================================================================
>> --- src/java/javax/jdo/PersistenceManager.java (revision 201765)
>> +++ src/java/javax/jdo/PersistenceManager.java (working copy)
>> @@ -224,6 +224,7 @@
>> * @param cls the <code>Class</code> of candidate instances
>> * @param queryName the name of the query to look up in metadata
>> * @return the new <code>Query</code>
>> + * @since 2.0
>> */
>> Query newNamedQuery (Class cls, String queryName);
>>
>> @@ -323,6 +324,7 @@
>> * equivalent to <code>getObjectById(oid, true);
>> * @param oid The object id of the object to load
>> * @return the corresponding persistent instance
>> + * @since 2.0
>> */
>> Object getObjectById (Object oid);
>>
>> @@ -691,7 +693,8 @@
>> * <code>PersistenceManager</code>, the default is the cache
>> should be ignored for queries.
>> * @return the ignoreCache setting.
>> */
>> - boolean getIgnoreCache();
>> + boolean getIgnoreCache();
>> +
>> /**
>> * Detach the specified object from the
>> <code>PersistenceManager</code>.
>> * @param pc the instance to detach
>>
>
> 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
Re: Another api20 change
Posted by Craig Russell <Cr...@Sun.COM>.
Hi Michael,
Looks good to check in.
Craig
On Jun 26, 2005, at 1:55 PM, Michael Bouschen wrote:
> Hi,
>
> attached you find some changes of the api20 project. It adds method
> isDetached to the StateManager interface and add since tags to two
> PM methods.
>
> Regards Michael
>
> --
> 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
>
> Index: src/java/javax/jdo/spi/StateManager.java
> ===================================================================
> --- src/java/javax/jdo/spi/StateManager.java (revision 201765)
> +++ src/java/javax/jdo/spi/StateManager.java (working copy)
> @@ -119,6 +119,17 @@
> * in the current transaction.
> */
> boolean isDeleted(PersistenceCapable pc);
> +
> + /** Tests whether this object has been detached.
> + *
> + * Instances that have been detached return <code>true</code>.
> + *
> + *<P>Transient instances return <code>false</code>.
> + *<P>
> + * @see PersistenceManager#detachCopy(Object pc)
> + * @param pc the calling <code>PersistenceCapable</code> instance
> + * @return <code>true</code> if this instance was detached.
> + boolean isDetached(PersistenceCapable pc);
>
> /** Return the <code>PersistenceManager</code> that owns this
> instance.
> * @param pc the calling <code>PersistenceCapable</code> instance
> Index: src/java/javax/jdo/PersistenceManager.java
> ===================================================================
> --- src/java/javax/jdo/PersistenceManager.java (revision 201765)
> +++ src/java/javax/jdo/PersistenceManager.java (working copy)
> @@ -224,6 +224,7 @@
> * @param cls the <code>Class</code> of candidate instances
> * @param queryName the name of the query to look up in metadata
> * @return the new <code>Query</code>
> + * @since 2.0
> */
> Query newNamedQuery (Class cls, String queryName);
>
> @@ -323,6 +324,7 @@
> * equivalent to <code>getObjectById(oid, true);
> * @param oid The object id of the object to load
> * @return the corresponding persistent instance
> + * @since 2.0
> */
> Object getObjectById (Object oid);
>
> @@ -691,7 +693,8 @@
> * <code>PersistenceManager</code>, the default is the cache
> should be ignored for queries.
> * @return the ignoreCache setting.
> */
> - boolean getIgnoreCache();
> + boolean getIgnoreCache();
> +
> /**
> * Detach the specified object from the
> <code>PersistenceManager</code>.
> * @param pc the instance to detach
>
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!