Return-Path: X-Original-To: apmail-isis-users-archive@www.apache.org Delivered-To: apmail-isis-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8696B10626 for ; Mon, 9 Feb 2015 14:36:48 +0000 (UTC) Received: (qmail 32261 invoked by uid 500); 9 Feb 2015 14:36:48 -0000 Delivered-To: apmail-isis-users-archive@isis.apache.org Received: (qmail 32232 invoked by uid 500); 9 Feb 2015 14:36:48 -0000 Mailing-List: contact users-help@isis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@isis.apache.org Delivered-To: mailing list users@isis.apache.org Received: (qmail 32221 invoked by uid 99); 9 Feb 2015 14:36:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Feb 2015 14:36:48 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW X-Spam-Check-By: apache.org Received-SPF: error (athena.apache.org: local policy) Received: from [209.85.216.174] (HELO mail-qc0-f174.google.com) (209.85.216.174) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Feb 2015 14:36:42 +0000 Received: by mail-qc0-f174.google.com with SMTP id i8so1196794qcq.5 for ; Mon, 09 Feb 2015 06:36:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=LmGgRBxt8jzJFc8lkn1oWvMV3duumrH7rj/NebRBYpQ=; b=CqFOBRXtQlZBU7GokMAG/ffpYqmXzgzqwYM1YW8OmPwcbusL8QTZsS0EtAh6Zc7/bT /rAJ13nw0hDm3nm5ZhkN4cP1sdDITgbaTEDL4KmdgTnja2SjA82yfQ/AIiwKznPmKOQ9 oXDMVWaR1AbrF/hL1LOS2Ix75CSp5I44EJ7FOl/jM5lsJUy/zlwnNVZ1T0xjCJ6bvP7i /dh1mP/1PAhm3p6ZBkJrHSQAHCoGSHnpaancjhFlaIKLOn4DZDO7A14GUv+EUFZdtAtX 9b6FwcmXYbTONh9HWcTMAFGU8DCwDzWFtzLPEokKod6abRJI0PClPeKIMBqcZmF8SQqr an7g== X-Gm-Message-State: ALoCoQnjTHYzb4ZagvXACrmRflxdPUiii33uZ87MHe8zhOF+Q6na/FPTIVIyxcfKS2hueRcGshIw X-Received: by 10.224.119.199 with SMTP id a7mr25925238qar.68.1423492561999; Mon, 09 Feb 2015 06:36:01 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.25.202 with HTTP; Mon, 9 Feb 2015 06:35:41 -0800 (PST) X-Originating-IP: [193.178.95.4] In-Reply-To: References: From: Dan Haywood Date: Mon, 9 Feb 2015 14:35:41 +0000 Message-ID: Subject: Re: Unable to re-create a view model To: users Content-Type: multipart/alternative; boundary=001a11c2f9b47fb245050ea8b0bc X-Virus-Checked: Checked by ClamAV on apache.org --001a11c2f9b47fb245050ea8b0bc Content-Type: text/plain; charset=UTF-8 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 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 > 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 > 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 > > > > > > --001a11c2f9b47fb245050ea8b0bc--