Hi James, can you create a small example on github that reproduces the problem, then I can take a look into it in more detail. Thx Dan
On 23 March 2014 15:16, james agada <[email protected]> wrote: > Any one with any ideas how to fix this? > > > On Sat, Mar 22, 2014 at 5:12 PM, james agada <[email protected]> wrote: > > > OK. I have gone through and identified what is happening. What I don't > >> know is why. In the RootOidDefault class, there is this code > > > > /** > >> > >> * If specify version sequence, can optionally specify user and/or > >> utc timestamp that the oid was changed. This is used for informational > >> purposes only. > >> > >> */ > >> > >> public RootOidDefault(ObjectSpecId objectSpecId, final String > >> identifier, final State state, Long versionSequence, String versionUser, > >> Long versionUtcTimestamp) { > >> > >> this(objectSpecId, identifier, state, > >> Version.create(versionSequence, versionUser, versionUtcTimestamp)); > >> > >> } > >> > >> > >> public RootOidDefault(ObjectSpecId objectSpecId, final String > >> identifier, final State state, Version version) { > >> > >> Ensure.ensureThatArg(objectSpecId, is(not(nullValue()))); > >> > >> Ensure.ensureThatArg(identifier, is(not(nullValue()))); > >> > >> Ensure.ensureThatArg(identifier, > is(not(IsisMatchers.contains("#"))), > >> "identifier '" + identifier + "' contains a '#' symbol"); > >> > >> Ensure.ensureThatArg(identifier, > is(not(IsisMatchers.contains("@"))), > >> "identifier '" + identifier + "' contains an '@' symbol"); > >> > >> Ensure.ensureThatArg(state, is(not(nullValue()))); > >> > >> > >> > >> this.objectSpecId = objectSpecId; > >> > >> this.identifier = identifier; > >> > >> this.state = state; > >> > >> this.version = version; > >> > >> initialized(); > >> > >> } > >> > >> > > This line > > > > > >> Ensure.ensureThatArg(identifier, > is(not(IsisMatchers.contains("@" > >> ))), "identifier '" + identifier + "' contains an '@' symbol"); > > > > raises the IllegalArgumentException whenever the identifier contains "@". > > However when the object is from the view DailySalesTotalForParty, the > > identifier does indeed contain "@". So now the question is > > 1. Why is this particular case excluded? > > 2. Why does it arise? I suspect the identifier is provided by > DataNucleus. > > I am using MySQL - does this have any impact? Can Datanucleus be > configured > > to not include @ in the identifier? > > 3. How should this be fixed? Can't be from the view definition. What > > happens if this check is not enforced? > > > > > > On Tue, Mar 18, 2014 at 12:36 AM, Dan Haywood < > > [email protected]> wrote: > > > >> Not completely sure what's happening yet, but I think that Isis is > >> expecting an object being loaded by JDO to be a regular entity, and > >> instead > >> it's getting an SCO (a JDO term, I think it means "secondary class > >> object"). This is probably the view object that was defined. > >> > >> Whatever. > >> > >> Searching through the code, that "contains an '@' symbol" string appears > >> in > >> the constructor for RootOidDefault. > >> > >> Could you put a break point there with a conditional to break only when > >> the > >> identifier contains an "@" symbol (as per [1]); when you hit the > >> breakpoint > >> could you then copy out the stacktrace for me. > >> > >> Thx > >> Dan > >> > >> [1] > >> > >> > https://www.dropbox.com/s/yjt8efefb9tis2d/Screenshot%202014-03-17%2023.34.03.png > >> > >> > >> > >> On 17 March 2014 23:27, james agada <[email protected]> wrote: > >> > >> > I checked the source code and the error seems to be raised from here > >> > > >> > private <T> T withLogging(PersistenceCapable pojo, Callable<T> > >> > runnable, CalledFrom calledFrom) { > >> > > if (LOG.isDebugEnabled()) { > >> > > LOG.debug(logString(calledFrom, LoggingLocation.ENTRY, > >> > pojo)); > >> > > } > >> > > try { > >> > > return runnable.call(); > >> > > } catch (Exception e) { > >> > > throw new RuntimeException(e); > >> > > } finally { > >> > > if (LOG.isDebugEnabled()) { > >> > > LOG.debug(logString(calledFrom, > LoggingLocation.EXIT, > >> > pojo)); > >> > > } > >> > > } > >> > > } > >> > > > >> > > > >> > from > >> > > >> > > >> > > >> > org.apache.isis.objectstore.jdo.datanucleus.persistence.FrameworkSynchronizer.withLogging(FrameworkSynchronizer.java:273) > >> > . > >> > What I don't know is why and under what circumstances should the > >> > RuntimeException be raised. > >> > > >> > > >> > On Mon, Mar 17, 2014 at 9:54 PM, Jeroen van der Wal < > >> [email protected] > >> > >wrote: > >> > > >> > > Hi James, > >> > > > >> > > The invoice summaries in Estatio also contain queries. > >> > > > >> > > Example: > >> > > > >> > > > >> > > >> > https://github.com/estatio/estatio/blob/master/dom/src/main/java/org/estatio/dom/invoice/viewmodel/InvoiceSummaryForInvoiceRun.java > >> > > Accessed through the repository: > >> > > > >> > > > >> > > >> > https://github.com/estatio/estatio/blob/master/dom/src/main/java/org/estatio/dom/invoice/viewmodel/InvoiceSummariesForInvoiceRun.java > >> > > > >> > > Hope this helps. > >> > > > >> > > Jeroen > >> > > On 17 Mar 2014 20:50, "james agada" <[email protected]> wrote: > >> > > > >> > > > any help? Cant seem to be able to track this down. > >> > > > > >> > > > > >> > > > On Sun, Mar 16, 2014 at 7:52 PM, james agada < > [email protected]> > >> > > wrote: > >> > > > > >> > > > > Following the examples in Estatio, I have defined a query model > >> like > >> > > this > >> > > > > > >> > > > >> > >> > > > >> @javax.jdo.annotations.PersistenceCapable( > >> > > > >> > >> > > > >> identityType = IdentityType.NONDURABLE, > >> > > > >> > >> > > > >> table = "DailySalesTotalForParty", > >> > > > >> > >> > > > >> extensions = { > >> > > > >> > >> > > > >> @Extension(vendorName = "datanucleus", key = > >> > > > >> "view-definition-mysql", > >> > > > >> > >> > > > >> value = "CREATE VIEW {DailySalesTotalForParty} " + > >> > > > >> > >> > > > >> "( " + > >> > > > >> > >> > > > >> " {this.transactionDate}, " + > >> > > > >> > >> > > > >> " {this.totalAmount} ," + > >> > > > >> > >> > > > >> " {this.fromPartyReference}, " + > >> > > > >> > >> > > > >> " {this.transactiontype} " + > >> > > > >> > >> > > > >> ") AS " + > >> > > > >> > >> > > > >> "SELECT " + > >> > > > >> > >> > > > >> " {Transaction.transactionDate} , " + > >> > > > >> > >> > > > >> > >> > > > >> " SUM({Transaction.faceValue}) AS > >> totalAmount > >> > > ," + > >> > > > >> > >> > > > >> // " > >> \"Transaction\".\"fromParty_Party_ID_OID\" > >> > > AS > >> > > > >> \"fromParty\", " + > >> > > > >> > >> > > > >> " {Transaction.fromPartyReference} , " + > >> > > > >> > >> > > > >> > >> > > > >> " {Transaction.transactiontype} " + > >> > > > >> > >> > > > >> " FROM " + > >> > > > >> > >> > > > >> " {Transaction} " + > >> > > > >> > >> > > > >> "GROUP BY " + > >> > > > >> > >> > > > >> " {Transaction.transactionDate}, " + > >> > > > >> > >> > > > >> " {Transaction.fromPartyReference}, " + > >> > > > >> > >> > > > >> " {Transaction.transactiontype} " > >> > > > >> > >> > > > >> + > >> > > > >> > >> > > > >> "ORDER BY " + > >> > > > >> > >> > > > >> " {Transaction.transactionDate}, " + > >> > > > >> > >> > > > >> " {Transaction.fromPartyReference}, " + > >> > > > >> > >> > > > >> " {Transaction.transactiontype}" > >> > > > >> > >> > > > >> ) > >> > > > >> > >> > > > >> }) > >> > > > >> > >> > > > >> @javax.jdo.annotations.Inheritance(strategy = > >> > > > >> InheritanceStrategy.NEW_TABLE) > >> > > > >> > >> > > > >> @javax.jdo.annotations.Queries( { > >> > > > >> > >> > > > >> @javax.jdo.annotations.Query( > >> > > > >> > >> > > > >> name="DailySalesForParty", language="JDOQL", > >> > > > >> > >> > > > >> value="SELECT FROM dom.todo.DailySalesTotalForParty WHERE > >> > > > >> fromPartyReference == :party ") > >> > > > >> > >> > > > >> }) > >> > > > >> > >> > > > >> @Bookmarkable > >> > > > >> > >> > > > >> @Immutable > >> > > > >> > >> > > > >> public class DailySalesTotalForParty { ........ > >> > > > >> > >> > > > > > >> > > > > I try to get the records from the view using the Query > definition > >> in > >> > a > >> > > > > service as > >> > > > > > >> > > > >> @Programmatic > >> > > > >> > >> > > > >> public List<DailySalesTotalForParty> > >> > getDailySalesTotalForParty(Party > >> > > > p){ > >> > > > >> > >> > > > >> //get party id > >> > > > >> > >> > > > >> //get party > >> > > > >> > >> > > > >> //String party = p.getUniqueRef(); > >> > > > >> > >> > > > >> //party="2"; > >> > > > >> > >> > > > >> return allMatches( > >> > > > >> > >> > > > >> new QueryDefault<DailySalesTotalForParty>( > >> > > > DailySalesTotalForParty.class, > >> > > > >> > >> > > > >> "DailySalesForParty", > >> > > > >> > >> > > > >> "party",p.getUniqueRef()); > >> > > > >> > >> > > > >> } > >> > > > >> > >> > > > > > >> > > > > But I end up with this error during runtime > >> > > > > > >> > > > > [exec] 19:52:40,699 [Native qtp1993764967-32 > DEBUG] > >> > > > SELECT > >> > > > >> 'dom.todo.DailySalesTotalForParty' AS > >> > > > >> > >> > > > > >> > > > >> > > >> > NUCLEUS_TYPE,`A0`.`FROMPARTYREFERENCE`,`A0`.`TOTALAMOUNT`,`A0`.`TRANSACTIONDATE`,`A0`.`TRANSACTIONTYPE` > >> > > > >> FROM `DAILYSALESTOTALFORPARTY` `A0` WHERE > >> `A0`.`FROMPARTYREFERENCE` > >> > = > >> > > > <'2'> > >> > > > >> > >> > > > >> [exec] 19:52:40,778 [RequestCycleExtra > qtp1993764967-32 > >> > WARN > >> > > ] > >> > > > >> ******************************** > >> > > > >> > >> > > > >> [exec] 19:52:40,778 [RequestCycleExtra > qtp1993764967-32 > >> > WARN > >> > > ] > >> > > > >> Handling the following exception > >> > > > >> > >> > > > >> [exec] org.apache.wicket.WicketRuntimeException: Error > >> > attaching > >> > > > >> this container for rendering: [WebMarkupContainer [Component > id = > >> > > body]] > >> > > > >> > >> > > > >> [exec] at > >> > > > >> > >> > > > > >> > > > >> > > >> > org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1693) > >> > > > >> > >> > > > >> [exec] > >> > > > >> > >> > > > > .......... > >> > > > > > >> > > > > [exec] Caused by: java.lang.RuntimeException: > >> > > > > java.lang.IllegalArgumentException: identifier > >> > > > > > >> > > 'org.datanucleus.identity.SCOID_org.datanucleus.identity.SCOID@73946e71 > >> > > ' > >> > > > > contains an '@' symbol > >> > > > > > >> > > > > [exec] at > >> > > > > > >> > > > > >> > > > >> > > >> > org.apache.isis.objectstore.jdo.datanucleus.persistence.FrameworkSynchronizer.withLogging(FrameworkSynchronizer.java:273) > >> > > > > > >> > > > > [exec] at > >> > > > > > >> > > > > >> > > > >> > > >> > org.apache.isis.objectstore.jdo.datanucleus.persistence.FrameworkSynchronizer.withLogging(FrameworkSynchronizer.java:282) > >> > > > > > >> > > > > [exec] at > >> > > > > > >> > > > > >> > > > >> > > >> > org.apache.isis.objectstore.jdo.datanucleus.persistence.FrameworkSynchronizer.postLoadProcessingFor(FrameworkSynchronizer.java:69) > >> > > > > > >> > > > > [exec] at > >> > > > > > >> > > > > >> > > > >> > > >> > org.apache.isis.objectstore.jdo.datanucleus.persistence.queries.PersistenceQueryProcessorAbstract.loadAdapters(PersistenceQueryProcessorAbstract.java:82) > >> > > > > > >> > > > > [exec] at > >> > > > > > >> > > > > >> > > > >> > > >> > org.apache.isis.objectstore.jdo.datanucleus.persistence.queries.PersistenceQueryFindUsingApplibQueryProcessor.process(PersistenceQueryFindUsingApplibQueryProcessor.java:64) > >> > > > > > >> > > > > [exec] at > >> > > > > > >> > > > > >> > > > >> > > >> > org.apache.isis.objectstore.jdo.datanucleus.persistence.queries.PersistenceQueryFindUsingApplibQueryProcessor.process(PersistenceQueryFindUsingApplibQueryProcessor.java:43) > >> > > > > > >> > > > > [exec] at > >> > > > > > >> > > > > >> > > > >> > > >> > org.apache.isis.objectstore.jdo.datanucleus.DataNucleusObjectStore.processPersistenceQuery(DataNucleusObjectStore.java:542) > >> > > > > > >> > > > > [exec] at > >> > > > > > >> > > > > >> > > > >> > > >> > org.apache.isis.objectstore.jdo.datanucleus.DataNucleusObjectStore.loadInstancesAndAdapt(DataNucleusObjectStore.java:537) > >> > > > > > >> > > > > [exec] at > >> > > > > > >> > > > > >> > > > >> > > >> > org.apache.isis.core.runtime.system.persistence.PersistenceSession$1.execute(PersistenceSession.java:461) > >> > > > > > >> > > > > [exec] at > >> > > > > > >> > > > > >> > > > >> > > >> > org.apache.isis.core.runtime.system.persistence.PersistenceSession$1.execute(PersistenceSession.java:458) > >> > > > > > >> > > > > [exec] at > >> > > > > > >> > > > > >> > > > >> > > >> > org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.executeWithinTransaction(IsisTransactionManager.java:217) > >> > > > > > >> > > > > [exec] at > >> > > > > > >> > > > > >> > > > >> > > >> > org.apache.isis.core.runtime.system.persistence.PersistenceSession.getInstancesFromPersistenceLayer(PersistenceSession.java:458) > >> > > > > > >> > > > > [exec] at > >> > > > > > >> > > > > >> > > > >> > > >> > org.apache.isis.core.runtime.system.persistence.PersistenceSession.getInstances(PersistenceSession.java:454) > >> > > > > > >> > > > > [exec] at > >> > > > > > >> > > > > >> > > > >> > > >> > org.apache.isis.core.runtime.system.persistence.PersistenceSession.findInstances(PersistenceSession.java:391) > >> > > > > > >> > > > > [exec] at > >> > > > > > >> > > > > >> > > > >> > > >> > org.apache.isis.core.runtime.system.persistence.PersistenceSession.findInstances(PersistenceSession.java:386) > >> > > > > > >> > > > > [exec] at > >> > > > > > >> > > > > >> > > > >> > > >> > org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession$8.allMatchingQuery(RuntimeContextFromSession.java:260) > >> > > > > > >> > > > > [exec] at > >> > > > > > >> > > > > >> > > > >> > > >> > org.apache.isis.core.metamodel.services.container.DomainObjectContainerDefault.allMatches(DomainObjectContainerDefault.java:400) > >> > > > > > >> > > > > [exec] at > >> > > > > > >> > > > > >> > > > >> > > >> > org.apache.isis.applib.AbstractContainedObject.allMatches(AbstractContainedObject.java:175) > >> > > > > > >> > > > > [exec] at > >> > > > > > >> dom.todo.Partytypes.getDailySalesTotalForParty(Partytypes.java:392) > >> > > > > > >> > > > > [exec] at dom.todo.Party.getDailySales(Party.java:283) > >> > > > > > >> > > > > What could be wrong? What does > >> > > > > > >> > org.datanucleus.identity.SCOID_org.datanucleus.identity.SCOID@73946e71 > >> > > ' > >> > > > > contains an '@' symbol mean? Where do I start to look for the > >> > problem? > >> > > > > > >> > > > >> > >> > > > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > >> > > > >> > > >> > > > > >
