Re: My local Cayenne changes

From: Andrus (andru..bjectstyle.org)
Date: Fri Jan 03 2003 - 23:41:12 EST

  • Next message: Dirk Olmes: "Re: My local Cayenne changes"

    Hi Dave,

    Using opaque database mechanisms for the primary key generation was
    intentionally "overlooked" in Cayenne. The reason being a problem of
    retrieving the value, that was just assigned to the inserted row, back into
    the object on the Java side. This is absolutely essential for the O/R.

    Your use of Cayenne is indeed unusual, though rather cool. If we are to
    integrate this to Cayenne though, we need a solid mechanism to update the
    objects after the insert is done. Anybody has any comments on how this can
    be done?

    One question about your changes. What is "defaultValue"?

    Andrus

    At 03:53 PM 1/3/2003 -0500, Dave Slusher wrote:
    >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 - 23:40:12 EST