isis-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Haywood <...@haywood-associates.co.uk>
Subject Re: Unable to re-create a view model
Date Mon, 09 Feb 2015 14:35:41 GMT
My guess, then, is that the @ViewModel isn't handling references to other
view models.  I suspect that anything that isn't a simple value (int,
string, date etc) is being processed as an entity, and a bookmark is being
created for it.  But on rehydration this bookmark is converted to an oid
and then being (incorrectly) given to the JDO object store.

If I'm right, hopefully is fixable.  Feel free to take a look in the
ViewModelFacet implementations, see what you can make of it.

The workaround is for the view model object to explicitly implement
ViewModel, and return a memento; ie handle the viewmodel -> viewmodel
reference manually.

HTH
Dan


On 9 February 2015 at 14:30, Martin Grigorov <mgrigorov@apache.org> wrote:

> Hi Dan,
>
> The commit was a minor optimization.
> The problem is still there.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Mon, Feb 9, 2015 at 4:20 PM, Dan Haywood <dan@haywood-associates.co.uk>
> wrote:
>
> > Hi Martin,
> >
> > I saw a commit from you on JdoObjectIdSerializer following on from this
> > mail, so did you sort out the issue (or do I need to take a look
> tonight?)
> >
> > Cheers
> > Dan
> >
> >
> > On 9 February 2015 at 08:17, Martin Grigorov <mgrigorov@apache.org>
> wrote:
> >
> > > Hi,
> > >
> > > What could be the reason a ViewModel cannot be recreated with the
> > exception
> > > below ?
> > > Looking
> > > at
> > >
> >
> org.apache.isis.objectstore.jdo.datanucleus.persistence.spi.JdoObjectIdSerializer#toJdoObjectId()
> > > it tries to find '_' separator and use the string before it to decide
> > what
> > > class to load (byte, int, UUID, ...).
> > >
> > > In my case the ViewModel extends from an abstract ViewModel. The parent
> > one
> > > is annotated with @ViewModel and the child one with
> @DomainObject(nature
> > =
> > > Nature.VIEW_MODEL).
> > > I've tried different combinations with the annotations but it always
> > leads
> > > to this exception.
> > >
> > > Caused by:
> > > org.apache.isis.core.runtime.persistence.PojoRecreationException: Could
> > not
> > > recreate pojo for oid oid
> > >
> > >
> >
> KIVM:PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPG1lbWVudG8-PGtpdC5ib29rbWFyaz5LSVRfOkxfMTwva2l0LmJvb2ttYXJrPjxpbnB1dEVsZW1lbnQuYm9va21hcms-SU5IRVJJVEVEX0NPTkRJVElPTjpMXzE0MzwvaW5wdXRFbGVtZW50LmJvb2ttYXJrPjwvbWVtZW50bz4=
> > > at
> > >
> > >
> >
> org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault.adapterFor(AdapterManagerDefault.java:320)
> > > at
> > >
> > >
> >
> org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault.adapterFor(AdapterManagerDefault.java:305)
> > > at
> > >
> > >
> >
> org.apache.isis.core.runtime.persistence.container.DomainObjectContainerResolve.adapterFor(DomainObjectContainerResolve.java:104)
> > > at
> > >
> > >
> >
> org.apache.isis.core.runtime.persistence.container.DomainObjectContainerResolve.lookup(DomainObjectContainerResolve.java:55)
> > > at
> > >
> > >
> >
> org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession$7.lookup(RuntimeContextFromSession.java:211)
> > > at
> > >
> > >
> >
> org.apache.isis.core.metamodel.services.bookmarks.BookmarkServiceDefault.lookup(BookmarkServiceDefault.java:59)
> > > at
> > >
> > >
> >
> org.apache.isis.core.metamodel.facets.object.recreatable.RecreatableObjectFacetDeclarativeAbstract.initialize(RecreatableObjectFacetDeclarativeAbstract.java:89)
> > > at
> > >
> > >
> >
> org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorDefault.recreatePojo(PojoRecreatorDefault.java:49)
> > > at
> > >
> > >
> >
> org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorForDataNucleus.recreatePojo(PojoRecreatorForDataNucleus.java:34)
> > > at
> > >
> > >
> >
> org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorUnified.recreatePojo(PojoRecreatorUnified.java:38)
> > > at
> > >
> > >
> >
> org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault.adapterFor(AdapterManagerDefault.java:317)
> > > ... 54 more
> > > Caused by: java.lang.StringIndexOutOfBoundsException: String index out
> of
> > > range: -1
> > > at java.lang.String.substring(String.java:1958)
> > > at
> > >
> > >
> >
> org.apache.isis.objectstore.jdo.datanucleus.persistence.spi.JdoObjectIdSerializer.toJdoObjectId(JdoObjectIdSerializer.java:112)
> > > at
> > >
> > >
> >
> org.apache.isis.objectstore.jdo.datanucleus.DataNucleusObjectStore.loadPojo(DataNucleusObjectStore.java:410)
> > > at
> > >
> > >
> >
> org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorForDataNucleus.recreatePojo(PojoRecreatorForDataNucleus.java:36)
> > > at
> > >
> > >
> >
> org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorUnified.recreatePojo(PojoRecreatorUnified.java:38)
> > > at
> > >
> > >
> >
> org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault.adapterFor(AdapterManagerDefault.java:317)
> > > ... 64 more
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> >
>

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