On Wed, 2003-03-12 at 10:53, Andriy Shapochka wrote:
>
> > to have in DataContext? The code is nearly identical (the PKGSupport
> > method appears slightly more complex... probably good reason :-)), and
> > createPermId is only used by a couple of tests.
> >
> > Should createPermId be deprecated and implemented in terms of
> > PKGSupport.createPermIdsForObjEntity() ?
> >
> > Craig
> >
>
> Maybe, we should remove the method from DataContext altogether. Are there
> any realistic scenarios when a Cayenne user can desire to create primary ids
> manually with DataContext.createPermId(...)? It looks very internal thing to
> me.
Well, like I said, we use it. We simply need to ensure that the object
*has* a permanent id, so perhaps "create" is a misnomer. I definitely
think there needs to some public API (as per comments by Andrus), but
just what that should be may lead to interesting debate! :-)
Some ideas (not fully formed, will probably have flaws):
1) Method on TempObjectId to ensure creation of perm id.
2) Method on DataContext which does the same sort of thing, but takes an
object as the argument.
3)... other?
2 seems reasonable... checks the objectid of the object. If a permanent
id is needed, uses PKGSupport to get it. Should work :-)
Craig
This archive was generated by hypermail 2.0.0 : Tue Mar 11 2003 - 16:57:36 EST