is this still supposed to be a valid id generation...
# questions
m
is this still supposed to be a valid id generation strategy?
Copy code
static mapping = {
        id              generator: 'uuid.hex' 
}
I seem to get this error:
Copy code
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is org.grails.datastore.mapping.model.DatastoreConfigurationException: Invalid id generation strategy for entity [com.k_int.ciim.mgmt.provider.Provider]: uuid.hex
on startup
t
I'm not sure; I've never tried that myself. But to add some more context for another person in the community who might be able to help you, what version of Grails are you using?
m
good point im using grails 6.1.2
I've ended up falling back to this strategy, which hopefully isn;t a mistake
Copy code
String id = UUID.randomUUID().toString()

static mapping = {
        id generator: 'assigned'
}
m
Hi Mark, this seems to work:
Copy code
class Book {

    String id
    Sting name

    static mapping = {
        id generator: 'org.hibernate.id.UUIDHexGenerator'
    }
}
That actually seems to do the same as:
Copy code
class Book {

    String id
    Sting name

    static mapping = {
        id generator: 'uuid'
    }
}
Or if you want to use a java UUID as the id:
Copy code
import java.util.UUID

class Book {

    UUID id
    Sting name

    static mapping = {
        id generator: 'uuid2'
    }
}
m
Thanks Mattias, I don't see any mention of uuid2 in https://docs.grails.org/latest/ref/Database%20Mapping/id.html
m
You are right. I created a PR to fix that.
🙌 1