cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Huss <>
Subject Re: cayenne.adapter.[domain].[node] property
Date Fri, 21 Dec 2012 21:45:23 GMT
Is it necessary to open a connection to the DB to get the metdata in order
to detect the adapter?  Couldn't you just look at the jdbc url scheme?

For migrations I'd like to allow for DB specific sql to be put in separate
files and then choose the correct file based on which DB is actually being
used.  I was looking at the Adapter classname for this, but if AutoAdapter
is used I can't tell what which DB it is.  So would the jdbc url be a
reliable source for this info?

Relatedly, what if AutoAdapter replaced itself with the actual adapter
after it was detected?  Wouldn't that be better that delegating?

On Mon, Dec 17, 2012 at 12:45 AM, Andrus Adamchik <>wrote:

> On Dec 16, 2012, at 1:48 AM, John Huss <> wrote:
> >>
> >>> 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?
> >
> >
> > Ok, deeper down I was calling
> >     dataNode.getAdapter().getExtendedTypes().registerType(...)
> > which was forcing the adapter to be loaded.  This appears not to happen
> if
> > I use the DI binding instead.  So problem solved!
> Cool. Yeah, a notion of ownership of certain objects by certain other
> objects (adapter owns ExtendedType, adapter owns PkGenerator, etc) is being
> obsoleted by DI, but is still reflected in the API. We'll be gradually
> cleaning this up.
> Andrus

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message