RE: Change cayenne.xml name dynamically

From: Pirola Davide (davide.pirol..tin.it)
Date: Tue Apr 12 2005 - 08:49:12 EDT

  • Next message: tnaki..ofthome.net: "working with views"

    Hi,
    using "DefaultConfiguration" i can read dimamically cayenne.xml.
    Thank's for you suggest :)

    Davide

    -----Original Message-----
    From: Bryan Lewis [mailto:brya..aine.rr.com]
    Sent: marted́ 12 aprile 2005 0.51
    To: cayenne-use..bjectstyle.org
    Subject: Re: Change cayenne.xml name dynamically

    I use very similar code, except mine says "new
    DefaultConfiguration(filename)" instead of FileConfiguration. According to
    the javadocs, the DefaultConfiguration searches the classpath, while
    FileConfiguration doesn't. (It's not clear to me how the FileConfiguration
    actually finds the file... it "ignores any other lookup strategies" and the
    filename " must not contain relative or absolute paths".) Using the
    DefaultConfiguration, I can put all my *cayenne.xml files in the root of my
    model.jar.

    The error message is probably misleading you. Looking at the source code, I
    see that the error message always says "cayenne.xml" regardless of what
    filename you gave it. It's probably trying to say that it can't find your
    file.

    ----- Original Message -----
    From: "Pirola Davide" <davide.pirol..tin.it>
    To: <cayenne-use..bjectstyle.org>
    Sent: Monday, April 11, 2005 11:21 AM
    Subject: Change cayenne.xml name dynamically

    Hi,
    i want use 2 cayenne.xml, 1 for develop and 1 for production.
    I have tried to use this code.

    String fileName = "my-dynamically-cayenne.xml";
    FileConfiguration conf = new FileConfiguration(fileName);
    Configuration.initializeSharedConfiguration(conf);

    but when i call the last line of code, i have an exception:

    org.objectstyle.cayenne.ConfigurationException: [v.1.1.1 March 13 2005]
    Error during Configuration initialization. [v.1.1.1 March 13 2005]
    [org.objectstyle.cayenne.conf.FileConfiguration] : Domain configuration file
    "cayenne.xml" is not found.

    Why during initialization, it search for a configuration file?
    I have configured a new name... so why cayenne search again cayenne.xml"?

    Thank's
    Davide



    This archive was generated by hypermail 2.0.0 : Tue Apr 12 2005 - 08:47:29 EDT