Re: bug in objectId generation?

From: Tomas Jucius (entire..mail.com)
Date: Wed Mar 15 2006 - 10:07:10 EST

  • Next message: Andrus Adamchik: "Re: caching problem ?"

    I don't think so:

    -------------------- test1 --------------------------------------------
    code:
            DataContext ctxt = getDataContext();
            for (int i = 0; i<100; i++) {
                Test test = (Test)ctxt.createAndRegisterNewObject(Test.class);
            }
            System.out.println(ctxt.newObjects().size());

    output: 100;

    -------------------- test2 --------------------------------------------
    code:

            DataContext ctxt = getDataContext();
            for (int i = 0; i<300; i++) {
                Test test = (Test)ctxt.createAndRegisterNewObject(Test.class);
            }
            System.out.println(ctxt.newObjects().size());

    output: 254;

    So??? Why only 254 new objects?

    TJ

    On 3/15/06, Andrus Adamchik <andru..bjectstyle.org> wrote:
    >
    > > So it is possible to create only 2^8 new objects with
    > > createAndRegisterNewObject().....
    >
    > No - 2^8^8
    >
    >
    >
    > On Mar 15, 2006, at 5:18 PM, Tomas Jucius wrote:
    > > Hi,
    > >
    > > I have found that ObjectId class constructor uses 8 byte objectId
    > > generation:
    > >
    > > public ObjectId(String entityName) {
    > > this.entityName = entityName;
    > > this.key = IDUtil.pseudoUniqueByteSequence8 (); //
    > > Returns 8 byte key - something strange..
    > > }
    > >
    > >
    > >
    > > So it is possible to create only 2^8 new objects with
    > > createAndRegisterNewObject().....
    > >
    > > Shouldn't you change this????
    > >
    > >
    > > I am using Cayenne 1.2M11..
    > >
    > >
    > >
    > >
    > > TJ
    > >
    > >
    > >
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Mar 15 2006 - 10:07:12 EST