Re: object id's are not sequential - ?

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Jan 10 2005 - 09:30:17 EST

  • Next message: Andrus Adamchik: "Re: Newbie: connected user"

    Hey Matt,

    There is no guarantee as to the order of PK assignments within the same
    commit batch. The sequence of createAndRegister* calls is not tracked
    anywhere...

    If it is important to have sequential PKs within the same commit cycle (or
    at least incrementing ... sequential is not guaranteed because of
    multithreading/multinstance issues), you can override
    setPersistenceState() and every time an oject becomes
    PersistenceState.NEW, you can manually access PK generator and assign
    object a permanent ObjectId... Or create your own versio of
    createAndRegister to do the same thing.

    Koka - your problem does not seem to be related to this question by Matt.
    I'll send a separate message on that.

    Andrus

    > dear list members -
    >
    > forgive potentially obvious question ..
    >
    > i call dataContext.createAndRegisterNewObject()
    > on objects A, B, and C .. respectively.
    >
    > after commitChanges() the object id's (pk) in the db
    > do not have the same ordering ?
    >
    > they appear like ...
    >
    > 1 - C
    > 2 - A
    > 3 - B
    >
    > or whatever :-/
    >
    >
    > is there some way to have the id's follow the
    > same ordering as the createAndRegisterNewObject() invocations?
    >
    > (aside from being heavy handed, and calling commitChanges())
    >
    > thanks!
    > -matt
    >
    > ~~
    > Marriage changes passion. Suddenly you're in bed with a relative.



    This archive was generated by hypermail 2.0.0 : Mon Jan 10 2005 - 09:30:19 EST