This is what I have now for the spin up:

runtime = ServerRuntime.builder()
        .addConfig("cayenne-PriceIncrease.xml")
        .addModule(binder -> {
            ServerModule.contributeProperties(binder)
                    .put("cayenne.jdbc.driver", "org.h2.Driver")
                    .put("cayenne.jdbc.url", "jdbc:h2:mem:CohortDB");
        })
        .build();
DataNode node = new DataNode("testNode");
runtime.getDataDomain().setDefaultNode(node);


And now on commit changes I get this:


Caused by: java.lang.NullPointerException
at
org.apache.cayenne.access.DataDomainInsertBucket.createPermIds(DataDomainInsertBucket.java:103)
at
org.apache.cayenne.access.DataDomainInsertBucket.appendQueriesInternal(DataDomainInsertBucket.java:73)
at
org.apache.cayenne.access.DataDomainSyncBucket.appendQueries(DataDomainSyncBucket.java:78)
at
org.apache.cayenne.access.DataDomainFlushAction.preprocess(DataDomainFlushAction.java:185)
at
org.apache.cayenne.access.DataDomainFlushAction.flush(DataDomainFlushAction.java:143)



On Wed, Oct 28, 2020 at 4:08 PM John Huss <johnth...@gmail.com> wrote:

> You could add a node at runtime:
>
> DataNode node = *new* DataNode("node");
>
> ... // configure node
>
> runtime.getDataDomain().addNode(node);
>
> runtime.getDataDomain().setDefaultNode(node);
>
> On Wed, Oct 28, 2020 at 2:52 PM Tony Giaccone <t...@giaccone.org> wrote:
>
> > So I have a project which is running in Bootique, but the data model is
> > used in several different apps. To facilitate this, we created a jar file
> > that includes the generated classes, and the code and the
> > cayenne-project.xml file in one jar file.  The result of this is tests
> run
> > for this jar, don't have access to the bootique runtime, as they are part
> > of a jar that's going to be included in other apps.
> >
> > We're using an older version of Bootique and so the version of Cayenne is
> > 4.0.B2
> >
> > The cayenne project, only has a datamap there is no datanode defined in
> the
> > xml.
> >
> > So I'm trying to spin up a cayenne runtime, using this code.
> >
> > runtime = ServerRuntime.builder()
> >         .addConfig("cayenne-CohortManager.xml")
> >         .addModule(binder -> {
> >             ServerModule.contributeProperties(binder)
> >                     .put("cayenne.jdbc.driver", "org.h2.Driver")
> >                     .put("cayenne.jdbc.url", "jdbc:h2:mem:CohortDB");
> >         })
> >         .build();
> >
> >
> > The problem is that later, when I try to commit changes, I get this
> error:
> >
> > org.apache.cayenne.CayenneRuntimeException: [v.4.0.B2 Sep 26 2017
> > 10:05:06] No DataNode configured for DataMap 'datamap' and no default
> > DataNode set
> >
> > I'm successfully able to run other tests, because they never do a
> > commitobjects.
> >
> >
> > Any suggestions on how to resolve my problem.
> >
>

Reply via email to