I have an application in migrating to MySQL and PostgreSQL and I both have different behaviors in the allocation of data.
By analyzing the database created in Postgres, I realized that the numbering of ID's created in each table are not being reset in change for another table. For example, it was set in the registers 3 'Table1' and counting the ID 1 to 3. When inserted into an object of another class in another table, the ID should be started for that table, but it follows the sequence of previous and when the object is persisted in 'table2' instead his first start with the ID continues to count from 4. I also noticed some changes in Mysql as the 'false' field 'boolean' is preenchdio with '0 'in Postgres is filled with' false '.
I updated the JDBC but the problem continues. I think maybe there should be some configuration of 'mapping' in the field, but not sure.
My DataSource is thus:
environments {
development {
dataSource {
dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
url = "jdbc:postgresql://localhost:5432/app"
driverClassName = "org.postgresql.Driver"
dialect = org.hibernate.dialect.PostgreSQLDialect
//url = "jdbc:mysql://localhost:3306/app"
username = "app"
password = "app123"
}
}
test {
dataSource {
dbCreate = "update"
url = "jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
username = "sa"
password = ""
}
}
production {
dataSource {
dbCreate = "update"
url = "jdbc:postgresql://localhost:5432/app"
driverClassName = "org.postgresql.Driver"
username = "postgres"
pooled = true
properties {
maxActive = -1
minEvictableIdleTimeMillis=1800000
timeBetweenEvictionRunsMillis=1800000
numTestsPerEvictionRun=3
testOnBorrow=true
testWhileIdle=true
testOnReturn=true
validationQuery="SELECT 1"
}
}
}
}
You can follow the same pattern as in Mysql Postgres?