grails部署开发
来源:互联网 发布:物联网编程技术 编辑:程序博客网 时间:2024/05/17 01:09
参考:The Grails Framework - Reference Documentation 网址:http://itrc.jju.edu.cn/1.1/guide/single.html#7.1%20Declaring%20Constraints
1 启动IntelliJ IDEA时候,如果出现:
SEVERE: Problems copying method. Incompatible JVM?
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor98.invoke(Unknown Source),则是由于Grails 不支持 JDK 1.8 版本。修改JDK为1.7即可。
2 CSVN在Windows上执行部署
httpd.exe -k install -n "CollabNet Subversion Server" -f "target\dist\data\conf\httpd.conf",其中找到httpd.exe,可以对其target\dist\data\conf\httpd.conf目录根据路径进行修改。
target\dist\bin\httpd.exe -k install -n "CollabNet Subversion Server" -f "data\conf\httpd.conf"
如果该服务运行失败,打开cmd,输入sc delete CollabNetSubversionServer 删除该服务,可以去services.msc进行查看。
3 withTransaction 用来处理事务
def transferFunds = { Account.withTransaction { status -> def source = Account.get(params.from) def dest = Account.get(params.to)5 Many-to-Manydef amount = params.amount.toInteger() if(source.active) { source.balance -= amount if(dest.active) { dest.amount += amount } else { status.setRollbackOnly() } }
}
}
如果目的账户没有处于活动状态,系统将回滚事务,同时如果有任何异常抛出在事务的处理过程中也将会自动回滚。
4 constraints验证或者约束
class User { String login String password String email Integer agestatic constraints = {
login(size:5..15, blank:false, unique:true) //
login
属性必须在5-15个字符长度之间,不能为空,并且必须是唯一的password(size:5..15, blank:false)
email(email:true, blank:false) age(min:18, nullable:false) }}
class Book { static belongsTo = Author static hasMany = [authors:Author] String title}class Author { static hasMany = [books:Book] String name}
Grails在数据库层使用一个连接表来映射many-to-many,在这种情况下,Author
负责持久化关联,并且是唯一可以级联保存另一端的一方 。
例如,下面这个可以进行正常级联保存工作:
new Author(name:"Stephen King") .addToBooks(new Book(title:"The Stand")) .addToBooks(new Book(title:"The Shining")) .save()
而下面这个只保存 Book
而不保存 authors!
new Book(name:"Groovy in Action") .addToAuthors(new Author(name:"Dierk Koenig")) .addToAuthors(new Author(name:"Guillaume Laforge")) .save()
- Grails环境部署开发
- grails部署开发
- Grails 部署
- grails数据库部署
- Grails开发Web服务
- Grails开发命令
- grails开发总结报告
- grails 开发笔记
- Grails 开发手册
- 使用 Geronimo 轻松地进行 Grails 部署
- Grails部署到Tomcat的系列问题
- grails gsp 无法热部署(2.4)
- 使用STS开发Grails应用
- 使用Netbeans开发Grails程序
- 用grails 开发restful service
- 使用STS开发Grails应用
- grails环境配置及开发
- grails
- iOS开发:正确使用const,static,extern
- 使用SeaJs高效构建页面
- pixhawk开发环境搭建
- Lua5.3——C API函数
- Effective Object-c 2.0 读书笔记
- grails部署开发
- 安卓实战中防止Button的频繁点击多次执行点击事件和点击切换文字
- RedHat Linux 手动设置IP及传送文件到远程主机
- 记录小白前端成长03
- “区块链”将重新定义人类生活,你会看懂么?
- leetcode 262. Trips and Users
- 运算符重载
- ""和null的区别
- 小记——内存映射