cached objects in the object context?
"Robert A. Decker" <[email protected]> Mon, 20 Apr 2026 13:49:30 +0200
| Newsgroups | gmane.comp.java.cayenne.user |
|---|---|
| Message-ID | <[email protected]> |
I have a couple of different systems modifying the database my cayenne =
code is talking to. Every now and then I see behaviour that I think says =
that something is being cached between database searches even though I =
create a new context before each search:
ObjectContext context =3D cayenne.newContext(); (cayenne is a =
ServerRuntime built like at the end of this message)
Even though I'm creating a new context before the search, could the =
server runtime that the context is built from be caching objects? If so, =
should I wipe the cache before the search? Or is there a way to make =
sure it doesn't work with a cache?
thanks,
Rob
cayenneRuntime =3D ServerRuntime.builder()
.addConfig("cayenne-project.xml")
.addModule(binder ->
ServerModule.contributePkGenerators(binder)
.put(MySQLAdapter.class.getName(), =
SmsPkGenerator.class))
.dataSource(DataSourceBuilder
=
.url(environment.getProperty("org.apache.cayenne.datasource.jdbc.url"))
=
.driver(environment.getProperty("org.apache.cayenne.datasource.jdbc.driver=
"))
=
.userName(environment.getProperty("org.apache.cayenne.datasource.jdbc.user=
name"))
=
.password(environment.getProperty("org.apache.cayenne.datasource.jdbc.pass=
word"))
=
.pool(Integer.parseInt(Objects.requireNonNull(environment.getProperty("org=
.apache.cayenne.datasource.jdbc.minConnections"))),
=
Integer.parseInt(Objects.requireNonNull(environment.getProperty("org.apach=
e.cayenne.datasource.jdbc.maxConnections"))))
.build())
.build();