Re: Design Issue: unique value

From: Joe Baldwin (jfbaldwi..arthlink.net)
Date: Thu Dec 27 2007 - 13:52:39 EST

  • Next message: Adam Yocum: "Re: Setting Default Values for Entities"

    Robert,

    > Depends on if you need incrementally unique identifiers, or if you
    > need just need a unique number.
    > I have situations where I need unique "transaction ids", but they
    > don't have to be ordered in any particular manner.
    > I use java's random number generation facilities to generate a
    > random number, then attempt to select a datarow from the database
    > with that number; if I successfully select one, the number isn't
    > unique and the process is repeated until I get a unique number. I
    > use 9 digit numbers, so the likelihood of ever generating the same
    > number twice is very small, and in practice, the loop never gets
    > executed twice.

    I see your point. This is an open issue right now but I think the
    client will want to have some sort of sequential numbering system.
    That is why I thought of employing the MySQL MAX() and then
    incrementing in the code.

    I am doing more reading and there appears to be Cayenne support for
    Jakarta Velocity #bind and #result directives but I haven't got my
    demo code to work yet so I don't know if this is the solution for a
    non-mapped result set.

    Joe



    This archive was generated by hypermail 2.0.0 : Thu Dec 27 2007 - 13:53:13 EST