is it possible in Apache Cayenne to prepopulate an ObjectContext without a database?

61 views Asked by At

I am evaluating Cayenne for some new projects.

I wonder if it is possible (for unit tests) to use Cayenne without a database and instead somehow prepopulate an ObjectContext from data I obtain from a file to reach an identical state as if it was read from the database?

1

There are 1 answers

1
andrus_a On BEST ANSWER

In theory yes, but practically this is too much trouble to implement. A much easier approach is to use an in-memory DB like Apache Derby. Frameworks like Bootique.io provide assistance with starting/stopping Derby and populating it with data, but this can be done on your own as well with a bit of effort.