Hi John, Both things - adapter and logger - are injectable. Here is a relevant ServerModule piece:
binder.bind(DbAdapterFactory.class).to(DefaultDbAdapterFactory.class); binder.bind(JdbcEventLogger.class).to(CommonsJdbcEventLogger.class); That's a general answer to your questions. See more specifics below... > I believe this property was removed a good while back although it was > present in 3.1 earlier: cayenne.adapter.[domain].[node] property > Why was it removed? Can we put it back? You can implement your own DbAdapterFactory that takes adapter name from a property. > My problem with AutoAdapter is that is causes a connection to be opened > immediately whereas a hard coded adapter does not. Does it have to do > that? It shouldn't. Could you provide a stack trace of the call that starts the connection? Maybe there's something preceding AutoAdapter initialization, like connection pool creation? > My other problem with AutoAdapter is that you can't access the jdbcLogger > in it -- I think this is probably just an oversight. Can we add > getJdbcEventLogger from JdbcAdapter into AutoAdapter and DbAdapter? DbAdapter no longer "owns" the logger. Logger is created in DI and is accessible via DI, either via injection or directly: JdbcEventLogger logger = runtime.getInjector(JdbcEventLogger.class); So no need to expose it in the interface. Andrus On Dec 13, 2012, at 8:43 PM, John Huss <[email protected]> wrote: > I believe this property was removed a good while back although it was > present in 3.1 earlier: cayenne.adapter.[domain].[node] property > Why was it removed? Can we put it back? > > I'd like to be able to switch DBs using the properties and doing so > requires changing the adapter, unless of course I use AutoAdapter. My > problem with AutoAdapter is that is causes a connection to be opened > immediately whereas a hard coded adapter does not. Does it have to do > that? I stepped through it before but I've forgotten why it does. > > My other problem with AutoAdapter is that you can't access the jdbcLogger > in it -- I think this is probably just an oversight. Can we add > getJdbcEventLogger from JdbcAdapter into AutoAdapter and DbAdapter? > > Thanks, > John
