I have an example in 3.0.2, but could update it sometime. With 3.1 (and 4.0) you'd use a Cayenne DI Module, which I did on another project, but it is far too large to share/etc. Here is my 3.0.2 example:
https://github.com/mrg/cbe/blob/master/UnitTesting/src/test/java/cbe/testing/AppTest.java Let me know if you'd like an updated (to 3.1) version. mrg On Fri, Jan 22, 2016 at 1:50 PM, Hugi Thordarson <[email protected]> wrote: > Ah, sorry about that… I’m using the current 4.0 snapshots. > > - hugi > > > > > On 22. jan. 2016, at 18:47, Michael Gentry <[email protected]> > wrote: > > > > Which version of Cayenne are you using? > > > > > > On Fri, Jan 22, 2016 at 1:25 PM, Hugi Thordarson <[email protected]> > wrote: > > > >> Hi all, > >> > >> I’m writing some tests for my DataObjects. Before the tests run, I’d > like > >> to provision an h2 database and switch my model’s connection to it for > the > >> purpose of testing. > >> > >> What’s the preferred way to switch the connection programmatically? > >> > >> Cheers, > >> - hugi > >
