SpringBoot and Cayenne

Tony Giaccone <[email protected]>
Newsgroups gmane.comp.java.cayenne.user
Message-ID <CALQ75kFsD-F_2CWOBsd2gJnkoOR_3TNFLqTy5_bhXhvqha0ccA@mail.gmail.com>
So I'm using the example that was posted here a while ago, and I've
modified it to read from a springboot yml file. I noticed that when the
application spins up, each time a new instance of the CayenneService gets
created, the code to spin up the cayenne runtime gets called.

I have a strong feeling that's not the right behavior.  So I've moved the
runtime to a class side property and then see if it's null before
spinning up the runtime. That seems to work.

My question is, in a well behaved Cayenne based application connected to
only one instance of a database, should there only be one instance of the
runtime, and one instance of the datasource?

Also the code has a shared context, which gets overridden each time the
init method is called.  That doesn't seem like a good idea either.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.