On 15 November 2011 09:27, Kevin Meyer - KMZ <[email protected]> wrote:

> I'm having a bit of grief with my Joomla/Isis mixed objectstore.
>
> I'm using the SqlObjectstore, with the SqlOidGenerator by default.
> Mostly, this is fine.
>
> But now when I create a (Member) object that needs to be persisted
> via the REST service, the oid has already been assigned, and I have
> no method of replacing the oid in the ObjectAdapter with the ID from
> Joomla!.
>

How is the object being created?  There's a whole lifecycle for Oids, with
the OidGenerator having a createTransientOid() method as well as a
convertTransientToPersistentOid() method.




>
> This action is occuring within the context of the ObjectStore#execute
> method, while executing a CreateObjectCommand.
>
> Is there any reason why I can't change the visibility of setOid(Oid oid)
> on PojoAdapter to public, so that I can replace the oid with the value
> returned via REST? Will anything go horribly wrong with changing oid's
> like this?
>

Yes, something will go horribly wrong ;-)

Hard to predict exactly what, but the AdapterManager maintains the
OidAdapterMap ( Oid -> pojo) and needs to be maintained.

Have a look around AdapterManager#remapAsPersistent() and see how it is
called by the other objectstores; hopefully will be enough of a clue...

Dan



>
> I don't really want to replace the SqlOidGenerator with a
> MixedOidGenerator, which splits out oid generation, too.
>
> Reminder: only Member objects are persisted by REST, while all
> others are persisted by the SqlObjectStore.
>
> Regards,
> Kevin
>
>

Reply via email to