download EJB design patterns ( http://www.theserverside.com/books/EJBDesignPatterns/index.jsp )
And read the UUID for EJB pattern.. IT describes a way to generate unique UUID's over time and (cyber)space; real neat :)
Besides that it also features two other patterns; one to get an incrementing counter and one that uses stored procedures (BMP)
Thanks i will check it out.