[keycloak-dev] Use UUID for IDs

Stian Thorgersen stian at redhat.com
Fri Feb 7 09:33:00 EST 2014



----- Original Message -----
> From: "Bill Burke" <bburke at redhat.com>
> To: keycloak-dev at lists.jboss.org
> Sent: Friday, 7 February, 2014 2:04:24 PM
> Subject: Re: [keycloak-dev] Use UUID for IDs
> 
> Not sure why I didn't use UUID in the first place.  I've used it in
> other code bases.  I guess maybe I wasn't sure if UUID.randomUUID()
> guaranteed that the UUID was always unique.  Wasn't clear if a time
> component is added to the UUID.

AFAIK there's no time component, but the risk of collision is extremely small

> 
> Are you going to use UUIDs for the whole model?

That was the plan

> 
> On 2/7/2014 5:45 AM, Matthias Wessendorf wrote:
> > +1 on UUIDs; we do same on UPS
> >
> > On Friday, February 7, 2014, Stian Thorgersen <stian at redhat.com
> > <mailto:stian at redhat.com>> wrote:
> >
> >     I propose we use java.util.UUID to IDs generated by DB (JPA
> >     @GeneratedValue). Reasoning behind this is:
> >
> >
> > W/ the hibernate specific annotations?
> >
> >
> >     * IDs are the same independent of store used (JPA, Mongo,
> >     PicketLink, LDAP, etc)
> >     * Easy to support many RDBMS (some support sequence and/or identity,
> >     so it seems the recommended approach when you don't know what the db
> >     will be is table)
> >     * IDs can be generated without a "central" db
> >
> >     Also, we'd like to be able to export all data to a json then import
> >     into any store. We then need to make sure there's no conflicts in
> >     IDs. For example you first use KC with H2, then export all data,
> >     import into MySQL, then export all data, import into Mongo. I can
> >     see that causing some issues with IDs generated by DB.
> >
> >     This is related to DB issues (Mysql, PostgreSQL not working), Mongo
> >     store impl as well as move to using user id instead of username as
> >     the reference for a user.
> >
> >     _______________________________________________
> >     keycloak-dev mailing list
> >     keycloak-dev at lists.jboss.org <javascript:;>
> >     https://lists.jboss.org/mailman/listinfo/keycloak-dev
> >
> >
> >
> > --
> > Sent from Gmail Mobile
> >
> >
> > _______________________________________________
> > keycloak-dev mailing list
> > keycloak-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/keycloak-dev
> >
> 
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
> _______________________________________________
> keycloak-dev mailing list
> keycloak-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-dev
> 


More information about the keycloak-dev mailing list