Dynamic loading of configuration mapping

From: caden whitaker (caden.whitake..mail.com)
Date: Wed Oct 27 2010 - 13:27:37 UTC

  • Next message: Mike Kienenberger: "Re: CayenneDataObject serialization"

    Hey all, thank you for your help so far! The latest thing I have been
    looking at is how to dynamically update the mapping files in cayenne. I see
    some methods available but I wanted to know what best practices were for
    this situation.

    For example, I am using the tutorial so I have an ARTIST, GALLERY and
    PAINTING table. I'm going to start the system running, then after I've
    initialized Cayenne I will dynamically change the TestAppMap.map.xml to add
    this new db-entity:

        <db-entity name="USER">
            <db-attribute name="UserID" type="BIGINT"/>
            <db-attribute name="Name" type="VARCHAR" length="255"/>
        </db-entity>

    No Foriegn Keys, no Objects, just a new db-entity for now. After I do this
    to the TestAppMap.map.xml how do I tell Cayenne to reload? I've been looking
    around and I don't see a clear method. I noticed these methods on
    Configuration:

    Configuration.shutdown();
    Configuration.initializeSharedConfiguration(obj);

    It seems like I would be making those method calls. Before I go down that
    rabbit hole I wanted to make sure I was on the right track. Should I be
    making these calls or is there a recommended way for doing what I'm doing?
    The other way that seemed possible was something like this:

    Configuration.shutdown();
    And then just wait for the next time this is called:
    ObjectContext context = DataContext.createDataContext();

    Would tha do the same thing? Since the file that it had used last time will
    be updated so it would be reading from the same source?

    As usual any help would be greatly appreciated.



    This archive was generated by hypermail 2.0.0 : Wed Oct 27 2010 - 13:28:09 UTC