For saving my grails database to a file rather than memory, I have just changed my data source in my grails app to:
development {
dataSource {
dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
url = "jdbc:h2:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
}
}
as shown in online tutorials.
However, when I create a User
object and save it to the database, it may have an id
of say, 1
. If I do some other operations then create another User
object is is given an ID
such as 14
, but never 2
.
I understand this may have something to do with Hibernate creating the ID for an object regardless of domain class?
Is there a way to get id's to be unique to domains?