db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig Russell <Craig.Russ...@Sun.COM>
Subject Spec clarification on pm.newInstance object id
Date Wed, 07 Sep 2005 16:53:16 GMT

I'd like to clarify the specification for the object-id for instances  
created using pm.newInstance.

Here's the original text, for context.

The following method is used to create an instance of a persistence- 
capable interface, or of a concrete or abstract class.
Object newInstance(Class persistenceCapable);
The parameter must be one of the following:
an abstract class that is declared in the metadata using the class  
element, or
an interface that is declared in the metadata using the interface  
element, or
a concrete class that is declared in the metadata as persistence- 
capable. In this case, there must be a public no-args constructor.
The returned instance is transient, and is an “instanceof” the  
parameter. Applications might use the instance via the get and set  
property methods and change its life cycle state exactly as if it  
were an instance of a persistence-capable class.

Here's the clarification to be added:

For interfaces and classes that use a SingleFieldIdentity as the  
object-id class, if the returned instance is subsequently made  
persistent, the target class stored in the object-id instance is the  
parameter of the newInstance method that created it.

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!

View raw message