cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Baldwin <>
Subject Re: Design Issue: unique value
Date Thu, 27 Dec 2007 18:52:39 GMT

> 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.


View raw message