Re: Status of MySQL AUTO_INCREMENT Support?

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Jan 19 2005 - 07:29:33 EST

  • Next message: André Luiz do Nascimento Sousa: "Re: Testing Spring + Cayenne Integration / Architectural Doubts"

    BTW, there seems to be a problem with the nightly builds in the last
    few days... I'll have to investigate what's going on...

    Andrus

    On Jan 18, 2005, at 4:03 PM, Gary Affonso wrote:

    > Thanks Andrus! I'll give it a try.
    >
    > - Gary
    >
    > On 1/18/05 12:37 PM, "Andrus Adamchik" <andru..bjectstyle.org> wrote:
    >
    >> Hi Gary,
    >>
    >> Current M1 already contains a "fake" support for autogenerated
    >> columns ...
    >> This is mostly workarounds for SQLServer to allow current Cayenne to
    >> work
    >> on top of auto-increment schema without throwing exceptions... With
    >> MySQL
    >> this worked even before M1.
    >>
    >> I promised to roll out the "real" support for a while, but it turned
    >> out
    >> to be a bigger change than originally envisioned. Mainly because of
    >> the
    >> issues with managing the object graph during commit when the some
    >> keys are
    >> not known before the commit....
    >>
    >> Now after two paragraphs of noise, here is the good news ;-)
    >> Auto-generated PKs mostly work in the last nightly build (01/18). You
    >> are
    >> more than welcome to try it out. No adapter extentions are needed.
    >> Just
    >> open your project in the Modeler, select MySQL adapter, and mark PK
    >> columns (DbAttributes) as "Auto" in the new Modeler.
    >>
    >> I say "mostly work" as there are a few things that still have to be
    >> cleaned up:
    >>
    >> (1) Modeler schema reverse/forward engineering ignores auto
    >> increment. So
    >> you have to check the checkbox manually, and also manually update the
    >> column property in the DB (very easy with phpMyAdmin)
    >>
    >> (2) One [rather uncommon] scenario is broken - If a dependent object
    >> obtains it key form another (master) object and master uses
    >> autincrement,
    >> you can't replace one master with another for dependent. This is
    >> uncommon
    >> as dependent objects are usually tied to their master for their life
    >> (e.g.
    >> UserDetail is never reassigned to a different User).
    >>
    >> There maybe other special cases that break .... I am doing some
    >> refactoring to make everything more consistent, but M2 may go out even
    >> before this is done, as IMO it is usable in its current state.
    >>
    >> Andrus
    >>
    >>
    >>> I'm evaluating Cayenne for an current project. It's a fairly large,
    >>> existing, database that uses MySQL AUTO_INCREMENT to handle the
    >>> primary
    >>> key fields. Switching to Cayenne's "pk table" just won't work,
    >>> there's
    >>> a LOT of legacy data there I just cannot change.
    >>>
    >>> But everything else in Cayenne looks great, and I'd vastly prefer an
    >>> alternative to Hibernate (which I'm using now) and it's constant
    >>> irritations (XML hell, code-generation difficulties, etc.). I swear,
    >>> using that product is like death-by-1000-irritants, particularly for
    >>> bottom-up efforts.
    >>>
    >>> I read back through the Cayenne archives and it looks like support
    >>> for
    >>> database-generated PK's (such as MySQL's AUTO_INCREMENT) is slated
    >>> for
    >>> 1.2, which is now at Milestone 1 with Milestone 2 being worked on.
    >>>
    >>> So...
    >>>
    >>> A few of questions:
    >>>
    >>> 1) What is the status for support of db-based PK generation in 1.2?
    >>> Is
    >>> it there?
    >>>
    >>> 2) Does (or will) 1.2 come with a MySQL adaptor that directly
    >>> implements
    >>> support for native-pk generation?
    >>>
    >>> 2a) Or is the plan to support the retrieval of db-generated keys in
    >>> an
    >>> architectural sense, but still leave it as an exercise for the user
    >>> to
    >>> subclass the MySQL adaptor?
    >>>
    >>> Thanks much. I'll keep dealing with Hibernate, for now, but I'm very
    >>> much hoping Cayenne can save me soon. :-)
    >>>
    >>> - Gary
    >>
    >>
    >>
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Jan 19 2005 - 07:29:41 EST