Re: ordering inserts of rows into single table

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Sep 07 2005 - 11:09:47 EDT

  • Next message: Mike Kienenberger: "Re: ordering inserts of rows into single table"

    On Sep 6, 2005, at 5:58 PM, Damir Bijuklic wrote:
    The trick is to setup a custom EntitySorter on the DataNode. As there
    is no "setEntitySorter" method (an oversight ... I will add this
    method), you'd have to do it either via reflection or by subclassing
    a DataNode per advice I posted just a few days back;

    http://objectstyle.org/cayenne/lists/cayenne-user/2005/09/0041.html

    For you custom implementation subclass AshwoodEntitySorter overriding
    "sortObjectsForEntity".

    Andrus

    > Hi,
    >
    > I have one somewhat silly problem...
    >
    > There are two tables with master/detail relationship.
    > I insert one record to master and multiple records to
    > detail. The system assigns detail numbers (not keys)
    > in sequential order inside database triggers, so i
    > invalidate inserted objects in order to fetch new
    > values.
    >
    > The problem is that i need to insert detail records in
    > specific order so they will be in a sequence.
    > Unfortunaly, cayenne inserts records in opposite
    > sequence of insertions to the detail collection in
    > master object.
    >
    > I don't think i can avoid database creating sequence
    > numbers, because it is needed from outside java, so it
    > should not be done in application...
    >
    > Is there a simple solution or should i just
    > use-the-source to do this?
    >
    > Damir



    This archive was generated by hypermail 2.0.0 : Wed Sep 07 2005 - 11:09:49 EDT