这是一个hibernate中的错误:
a different object with the same identifier value was already associated with the session
grails程序开发过程中不知道动了哪里,导致了上述问题的产生,网上有的说使用merge,refresh,clear来解决问题,但,实际上都没有真正解决问题,要找到产生问题的原因才行,否则,一个地方使用merge但是其他地方又出现了问题,还有的地方改成merge之后,还出现了乐观锁问题!
最后,没有办法,使用了我的无敌必杀技,排除法,把我最近的版本文件一个一个的移除,最终找到了问题的出处,是Domain中使用了
static constraints = {
username(blank: false)
username(unique: 'gameZone')
gameZone(blank: false);
}
这段代码我是想约束username,gamezone成为唯一索引,注释掉,问题就没有了!
将此处代码改成其他相似的方法吧!
static mapping = {
id composite: ['username','gameZone']
}
static constraints = {
username(blank: false)
gameZone(blank: false);
//username(unique: 'gameZone');
}
这种问题在正常的Grails开发中不会出现,但是如果你自己想在src/groovy中加入自己的一些有趣的东西时,那里用到domain,就可能产生这个问题了!
==================
Grails还有人用吗,我用着挺好的!!希望Grails越来越好!
转载请加链接:http://qixin000.iteye.com/blog/2087404
分享到:
相关推荐
Grails is a full stack web development framework that enables you to build complete web applications in a fraction of the time and with less code than other frameworks. In Grails: A Quick-Start Guide...
1.1 Let Me Tell You About Grails. . . . . . . . . . . . . . . . 10 1.2 How Does Grails Do It? . . . . . . . . . . . . . . . . . . . 11 1.3 Why This Book? . . . . . . . . . . . . . . . . . . . . . . . ...
The.Definitive.Guide.to.Grails.Second.Edition.2009
Grails is a Java- and Groovy-based web framework that is built for speed.... Companies as varied as LinkedIn, Wired, Tropicana, and Taco Bell are all using Grails. Are you ready to get started as well?
Grails 3开发邮件发送功能,完整教程!超级实用,手把手教你接入邮件发送
Grails-MyBatis 用于 Grails 框架的 MyBatis 插件 基于原始 Grails-iBatis 插件:Brian Sanders ( ) Grails 插件主页: : 修改: 命名约定的一些变化 添加了对多个数据源的完全支持 Grails 2.0 插件重构 最小 ...
Java web development is notoriously tedious, but help is on the way: Grails. Using the principle of convention-over-configuration and the dynamic Groovy programming language, Grails takes the pain out...
NULL 博文链接:https://search.iteye.com/blog/386023
Grails 上的 % Groovy % lyhcode % TWJUG 2014 年 9 月 20 日 你好,世界。 GitHub 中的示例代码 <style tyle="text/css"> pre.sourceCode { 背景:黑色; 填充:.5em; } .reveal h1 { /*background: -...
Grails Web 应用框架:grails-core
详细介绍grails框架的奥秘,英文版你值得拥有
Grails.2.A.Quick-Start.Guide.pdf
Agile Development with Groovy and Grails.pdf
Grails in Action is a comprehensive introduction to the Grails framework covering the nuts and bolts of all core Grails components: controllers, views, services, webflows, taglibs, Ajax, and plugins. ...
开始,你可以开始一个新的项目: 并将以下内容添加到您的依赖项中 compile("org.grails.plugins:hibernate-search:2.3.0") compile("org.grails.plugins:hibernate5:6.1.8") compile("org.grails.plugins:cache") ...
grails.2.5.1 环境,适用于Windows下Grails开发,具体配置请参照https://jingyan.baidu.com/article/86fae3461af6cf3c49121a91.html
Flex on Java Bernerd Allmon and Jeremy Anderson MEAP Began: May 2008 Softbound print: July 2010 (est.) | 375 pages ISBN: 1933988797 Part 1: Getting started 1. Some Flex with your ...11. Flex on Grails
The examples presented here use Groovy on Grails, a Java-based web technology stack. More details at http://grails.org. To get up and running: 0. Install Java on tyour machine if you need to. You'll ...
Grails Grails Grails Grails Grails