I’d like to use UUID instead of the regular id on
my models.
Can this be done with the play framework?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First don`t extend (play.db.jpa.Model) Model in the Model you want to generate the Id but use GenericModel.
then you could use helper class that called when object is created (in constructor).
or call the helper class when saved(thus i have to create wrapper DAO, the save process is done in wrapper DAO not in the Object so that i could generate id the save the object)
or if you want more simple approach use JPA UUID. See code below.