Re: Change cayenne.xml name dynamically

From: Bryan Lewis (brya..aine.rr.com)
Date: Mon Apr 11 2005 - 18:51:18 EDT

  • Next message: Holger Hoffstätte: "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 : Mon Apr 11 2005 - 18:51:22 EDT