FAQ
I have a warning that this 'new AutoAdapter(dataSource)' is
deprecated.

What do I do instead?

The implementation of the above uses deprecated methods,
otherwise I would have thought that the source provided the
solution on this one.

While injection is an implementation detail, it is used in the
documentation:

/**
* Returns a DbAdapterFactory configured to detect all databases
officially supported
* by Cayenne.
*
* @deprecated since 3.1 in favor of
* {@link
org.apache.cayenne.configuration.server.DbAdapterFactory}
* configured via dependency injection.
*/
public static DbAdapterFactory getDefaultFactory() {
return new DbAdapterFactoryChain(defaultFactories);
}


--
Øyvind Harboe

Can Zylin Consulting help on your project?

US toll free 1-866-980-3434 / International +47 51 87 40 27

http://www.zylin.com/zy1000.html
ARM7 ARM9 ARM11 XScale Cortex
JTAG debugger and flash programmer

Search Discussions

  • Andrus Adamchik at Feb 10, 2011 at 2:55 pm
    There is a new constructor for AutoAdapter:

    public AutoAdapter(Provider<DbAdapter> adapterProvider)
    While injection is an implementation detail, it is used in the
    documentation:
    We are still trying to write the Java classes managed via injection in a manner that should not prevent their creation in the code.

    Andrus

    On Feb 10, 2011, at 3:10 AM, Øyvind Harboe wrote:

    I have a warning that this 'new AutoAdapter(dataSource)' is
    deprecated.

    What do I do instead?

    The implementation of the above uses deprecated methods,
    otherwise I would have thought that the source provided the
    solution on this one.

    While injection is an implementation detail, it is used in the
    documentation:

    /**
    * Returns a DbAdapterFactory configured to detect all databases
    officially supported
    * by Cayenne.
    *
    * @deprecated since 3.1 in favor of
    * {@link
    org.apache.cayenne.configuration.server.DbAdapterFactory}
    * configured via dependency injection.
    */
    public static DbAdapterFactory getDefaultFactory() {
    return new DbAdapterFactoryChain(defaultFactories);
    }


    --
    Øyvind Harboe

    Can Zylin Consulting help on your project?

    US toll free 1-866-980-3434 / International +47 51 87 40 27

    http://www.zylin.com/zy1000.html
    ARM7 ARM9 ARM11 XScale Cortex
    JTAG debugger and flash programmer
  • Øyvind Harboe at Feb 11, 2011 at 9:45 am

    On Thu, Feb 10, 2011 at 3:55 PM, Andrus Adamchik wrote:
    There is a new constructor for AutoAdapter:

    public AutoAdapter(Provider<DbAdapter> adapterProvider)
    How do I create a Provider<DbAdapter>?

    I searched for examples in the Cayenne code, but what
    I found was in the DefaultDbAdapterFactory and I was
    not able to trace that back to anything that I could call.

    Is it just me or is it harder to search Cayenne code in e.g. Eclipse
    when injection is used? I think I had more success using
    the Cayenne source code as documentation,
    before injection entered the picture.
    While injection is an implementation detail, it is used in the
    documentation:
    We are still trying to write the Java classes managed via
    injection in a manner that should not prevent their creation
    in the code.
    A word of wisdom from K&R comes to mind:

    'simple things should be simple and hard things possible'

    Except for the deprecated methods, I think I've finished
    porting to Cayenne 3.1 though! Some nice new features
    allowed me to delete code. Always nice!

    --
    Øyvind Harboe

    Can Zylin Consulting help on your project?

    US toll free 1-866-980-3434 / International +47 51 87 40 27

    http://www.zylin.com/zy1000.html
    ARM7 ARM9 ARM11 XScale Cortex
    JTAG debugger and flash programmer

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriescayenne
postedFeb 10, '11 at 8:11a
activeFeb 11, '11 at 9:45a
posts3
users2
websitecayenne.apache.org

2 users in discussion

Øyvind Harboe: 2 posts Andrus Adamchik: 1 post

People

Translate

site design / logo © 2022 Grokbase