isis-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grigorov <mgrigo...@apache.org>
Subject Re: persist a new Object
Date Wed, 11 Mar 2015 16:07:30 GMT
Hi,

I think you need something like:

if (!(this instanceof javax.jdo.spi.PersistenceCapable)) {
return null;
}
OIDImpl longIdentity = (OIDImpl) JDOHelper.getObjectId(this);
return longIdentity.getKeyValue();

Martin Grigorov
Funemployed! Available for hire!
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Mar 11, 2015 at 5:58 PM, Lechner Andreas <alechner@at.focusmr.com>
wrote:

> Hi all,
>
> Maybe i have overseen something.
>
> I want to persist MyObject.
> It has a member ID which is a @PrimaryKey and @Persistent(valueStrategy =
> IdGeneratorStrategy.IDENTITY).
>
> When id do:
> PersistenceManager jdoPersistenceManager =
> isisJdoSupport.getJdoPersistenceManager();
> MyObject persistedObject = jdoPersistenceManager.makePersistent(myObject);
>
> I get an ID filled in the returned persistedObject.
>
> How do i get the ID of the fresh persisted MyObject when I use the
> injected DomainObjectContainer container?
> container.persistIfNotAlready(settingItem);
>
> I need the ID and want to use the implemented soloution from Apache ISIS
> and not to
> implement my own soloution.
>
> best regards
> Andreas
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message