Re: Error trying to commit

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue May 27 2003 - 01:28:02 EDT

  • Next message: Andrus Adamchik: "Re: Ordering on non-database field"

    On Monday, May 26, 2003, at 12:43 PM, Marconetto, Adrian Eduardo (A.)
    wrote:

    > Thanks Andrus!
    > You were right, I haven't configured any DataNode. I corrected this
    > and it begun to work.
    > By the way, when the modeler creates the Primary key support sequences
    > in the DB,  it specifies them beginning in 200 and incrementing by 20.
    > Is there any specific reason to do it that way, or they could be
    > created beginning with 1 and incrementing by 1?

    The reason for the increment = 20 is caching primary key range in the
    application, so that Cayenne would need to only access the sequence
    once for every 20 objects inserted into the same table. There is a big
    performance benefit in caching the keys.

    Now the fact that it starts from 200, is kind of a hack introduced long
    time ago when there was no way to configure sequence parameters (see
    more on that below). Starting a sequence at 200 for a new table would
    leave id's 1..199 outside of the application insertion range, thus
    allowing manual insertion via say sqlplus. This was used primarily for
    testing. Like I said this was a convenience hack, and it will most
    likely go away soon.

    > Other issue: I'm setting up my model over an existing database. When I
    > tried to create the primary key support sequence for one of my tables,
    > Oracle rejected the name suggested by the modeler
    > ("pk_ttis815_bkb_transactions_data") because it was too long.
    > I can't rename the table because it's used by other applications. How
    > can I still have primary key support for it??
    >  
    > PS: Yes, I know the name for the table is a bit long, but I'm not
    > responsible for it :) 

    You were not the only one in such situation. To address this one of our
    committers added the ability to configure sequence parameters (name,
    cache size). Right now this requires manual hacking of DataMap XML file:

        http://objectstyle.org/cayenne/lists/cayenne-user/2003/03/0016.html

    CayenneModeler doesn't support this (yet), but the good news are that
    once you change XML file manually, you can open and save it with
    Modeler. All you custom information will be preserved.

    Andrus



    This archive was generated by hypermail 2.0.0 : Tue May 27 2003 - 01:27:13 EDT