My local Cayenne changes

From: Dave Slusher (dslushe..uarded.net)
Date: Fri Jan 03 2003 - 15:53:25 EST

  • Next message: Craig Miskell: "Re: Contributions to Cayenne"

    To refresh y'alls memories, I'm currently using Cayenne only as a DB create
    time tool. This allows us to specify the logical schema in one place and
    then provision on different databases based on that schema. Because it is
    XML, we can version and track changes to the schema so that anonymous
    database changes disappear, etc. We get a lot of benefits from this mode of
    operation. We're keeping our options open about possibly using Cayenne in a
    more standard runtime mode at a later time.

    In order to fully get this to meet our needs, I had to make some
    modifications to our local copy of Cayenne. I had to add the following
    attributes to the set of datamap, MapLoader, DbAttribute, and my own
    Adapter subclasses.

    For the determination of whether this column needs DB native autoincrement
    support (sequence + triggers in Oracle, autoincrement tag in mysql) I added

    datamap:
    isAutoIncrement

    DbAttribute:
    get/setAutoIncrement methods

    with corresponding test in MapLoader.processStartDbAttribute

    For determination of whether this is Unsigned I added

    datamap:
    isUnsigned

    DbAttribute:
    get/setUnsigned methods

    For having a default value different than 0 or '', I added

    datamap:
    defaultValue="<value>"

    DbAttribute:
    String getDefaultValue() and
    void setDefaultValue(String) methods

    The obvious logic to act based on these DbAttributes was placed in the
    various Adapters to provide the right text in the create table statements.
    I'm not sure how general these needs are, but I suspect that as Cayenne
    proliferates all of this will become more common. For the native
    autoincrement support, y'all might want to consider the situation where
    Cayenne is but one of many possible interfaces to the DB. That's where we
    are - even if we move to Cayenne as an interface at runtime, there will
    always be non-Cayenne access to our DBs. We can't assume that Cayenne will
    be handling key generation and must require that to always be provided by
    the DB itself.

    Were any of these unnecessary? I looked through the code and couldn't find
    anywhere that any of these had the capacity to be set in baseline Cayenne
    so I tweaked all these interfaces. I just thought I'd send a courtesy note
    to the list pointing out that we ran into problems with this missing
    qualifications in the datamap/creation process.

    d



    This archive was generated by hypermail 2.0.0 : Fri Jan 03 2003 - 15:58:36 EST