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 Craig Russell <Cr...@Sun.COM> on 2005/07/05 22:43:35 UTC
VOTE: Change handling of null primary key during makePersistent of
SingleFieldIdentity classes
Javadogs,
A straightforward implementation of makePersistent will obtain the
value of the identity object by delegating to jdoNewObjectIdInstance
of the instance to be made persistent. This is the specified behavior:
A7.12-38 [For classes using single field identity, this method must
be called on an instance of a persistence-capable class with its
primary key field initialized (not null), or a
JDOFatalInternalException is thrown.]
The simple enhanced method will delegate to, e.g. new IntIdentity
passing the null field as the argument. This results in a
NullPointerException that needs to be caught by the enhanced code.
Proposal: Change the behavior of the SingleFieldIdentity classes to
throw JDONullIdentityFieldException. This allows a straightforward
implementation of enhanced classes to support single field identity.
[ ] approve
[ ] disapprove. Why?
Thanks,
Craig
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!
Re: VOTE: Change handling of null primary key during makePersistent
of SingleFieldIdentity classes
Posted by Michael Bouschen <mb...@spree.de>.
Hi Craig,
[x] approve
Regards Michael
> Javadogs,
>
> A straightforward implementation of makePersistent will obtain the
> value of the identity object by delegating to jdoNewObjectIdInstance
> of the instance to be made persistent. This is the specified behavior:
>
> A7.12-38 [For classes using single field identity, this method must be
> called on an instance of a persistence-capable class with its primary
> key field initialized (not null), or a JDOFatalInternalException is
> thrown.]
>
> The simple enhanced method will delegate to, e.g. new IntIdentity
> passing the null field as the argument. This results in a
> NullPointerException that needs to be caught by the enhanced code.
>
> Proposal: Change the behavior of the SingleFieldIdentity classes to
> throw JDONullIdentityFieldException. This allows a straightforward
> implementation of enhanced classes to support single field identity.
>
> [ ] approve
>
> [ ] disapprove. Why?
>
> Thanks,
>
> Craig
>
> 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