Hello, All
I have a domain class:
//////
package admin
class Settings {
static mapping = {
table 'SETTINGS'
version false
//name column : 'PARAMNAME'
value column : 'PARAMVALUE'
description column : 'DESCRIPTION'
id name: 'name', column : 'PARAMNAME'
}
String name;
String value;
String description;
static constraints = {
name maxSize: 150;
value maxSize: 150;
description maxSize: 1024;
}
}
/////
and I have an empty controller with static scaffold = true
When I am trying to save record a error is happened:
------------------
- Class: org.hibernate.StaleObjectStateException
- Message: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) : [admin.Settings#1]
189: chain.doFilter(request, response);
63: doFilter(request, response, chain);
Trace
Line | Method
->> 38 | $tt__save in SettingsController.groovy
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 189 | doFilter in PageFragmentCachingFilter.java
| 63 | doFilter in AbstractFilter.java
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
I run my application in a dev mode with default datasource settings:
///
dataSource {
pooled = true
jmxExport = true
driverClassName = "org.h2.Driver"
username = "sa"
password = ""
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
// cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' // Hibernate 3
cache.region.factory_class = 'org.hibernate.cache.ehcache.EhCacheRegionFactory' // Hibernate 4
singleSession = true // configure OSIV singleSession mode
}
// environment specific settings
environments {
development {
dataSource {
dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
}
}
.....
////
If I change code of domain class:
name column : 'PARAMNAME'
value column : 'PARAMVALUE'
description column : 'DESCRIPTION'
//id name: 'name', column : 'PARAMNAME'
than there is no errors.
What can I do to fix the problem?