That helped! Most examples of Datanucleus/JDO are without the Isis part. I 
found the transaction code in JDO update examples.

Thanks a lot. Right now I only have my domain model problems to solve ;-)

Erik
________________________________________
From: Dan Haywood [[email protected]]
Sent: Tuesday, April 01, 2014 4:10 PM
To: users
Subject: Re: Error returning from action

Hi Erik,

I'm pretty sure that it's your direct use of the currentTransaction().begin
and .commit() that's tripping up Isis.

Every action invocation (in fact, every interaction) is automatically
wrapped in a transaction, and any repository query automatically does a
flush.

If you simply miss out those calls to beginTran and commit(), does it work?
 Or have you "been there, done that" and there's a reason you chose to add
them?

Thx
Dan



On 1 April 2014 14:27, Erik de Hair <[email protected]> wrote:

> The actions creates a new company with the users company as the parent
> (reseller). There's a nested set JDO implementation for managing a company
> tree. The nested set is updated by the mentioned parent.addChild(childNode).
>
> I'm new to JDO. Try to execute a bulk update by modifying selected
> entities during an transaction.
>
>         List<CompanyNode> rightNodes =
> (List<CompanyNode>)qLeft.executeList();
>         // actual update
>         nsm.getPersistenceManager().currentTransaction().begin();
>         for (CompanyNode node : rightNodes) {
>            int newRight = node.getRightValue()+delta;
>                         node.setRightValue(newRight);
>                 }
>         nsm.getPersistenceManager().currentTransaction().commit();
>
>
>
> // action
> public AbstractCompany create(
>             final @Named("Bedrijfsnaam") String name,
>             final @Named("Is reseller") @Optional Boolean isReseller) {
>         AbstractCompany obj;
>         Company usersCompany =
> findCompanyRepresentedByUser(getUser().getName());
>
>         if(isReseller != null && isReseller){
>                 obj = newTransientInstance(Company.class);
>                 obj.setName(name);
>                 obj.setReseller(true);
>         } else {
>                 obj = newTransientInstance(EndUser.class);
>                 ((EndUser)obj).setReseller(usersCompany);
>                 obj.setReseller(false);
>                 obj.setName(name);
>         }
>         // create nestedSetElement for the new company
>         CompanyNode childNode = newTransientInstance(CompanyNode.class);
>         childNode.setName(obj.getName());
>         childNode.setCompany(obj);
>
>         Node<CompanyNode> parent =
> getNestedSetManager().getNode(usersCompany.getCompanyNode());
>         parent.addChild(childNode);
>         // Necessary?
>         obj.setCompanyNode(childNode);
>         persistIfNotAlready(obj);
>         persistIfNotAlready(parent);
>         return obj;
>     }
> ________________________________________
> From: Dan Haywood [[email protected]]
> Sent: Tuesday, April 01, 2014 3:11 PM
> To: users
> Subject: Re: Error returning from action
>
> Doesn't look right, that's for sure.
>
> Can you provide some more detail - what's in the action's implementation?
>
> Thx
> Dan
>
>
>
> On 1 April 2014 14:09, Erik de Hair <[email protected]> wrote:
>
> > Hello Isis users,
> >
> > I've got a problem popping up after returning from an action. Any one got
> > a clue?
> >
> > Thanks,
> > Erik
> >
> > Caused by: java.lang.IllegalStateException: illegal argument, expected:
> is
> > <true>
> > at
> >
> org.apache.isis.core.commons.ensure.Ensure.ensureThatState(Ensure.java:93)
> > at
> >
> org.apache.isis.objectstore.jdo.datanucleus.DataNucleusObjectStore.ensureInHibernateTransaction(DataNucleusObjectStore.java:641)
> > at
> >
> org.apache.isis.objectstore.jdo.datanucleus.DataNucleusObjectStore.ensureInTransaction(DataNucleusObjectStore.java:627)
> > at
> >
> org.apache.isis.objectstore.jdo.datanucleus.DataNucleusObjectStore.execute(DataNucleusObjectStore.java:338)
> > at
> >
> org.apache.isis.core.runtime.system.transaction.IsisTransaction.doFlush(IsisTransaction.java:388)
> > at
> >
> org.apache.isis.core.runtime.system.transaction.IsisTransaction.flush(IsisTransaction.java:337)
> > at
> >
> org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.flushTransaction(IsisTransactionManager.java:298)
> > at
> >
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.executeActionOnTargetAndProcessResults(ActionPanel.java:210)
> > at
> >
> org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.executeActionAndProcessResults(ActionPanel.java:165)
> > at
> >
> org.apache.isis.viewer.wicket.ui.components.actions.ActionParametersFormPanel$ActionParameterForm$1.onSubmit(ActionParametersFormPanel.java:160)
> > at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1253)
> > at org.apache.wicket.markup.html.form.Form.process(Form.java:925)
> > at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:771)
> > at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:704)
> >
>

Reply via email to