[color=red]//调用后,数据库会更新[/color]
def show(Long id) {
def c = Company.[b]get[/b](id)
c.name = 'testtest'
[company: c]
}
def show(Long id) {
def c = Company.[b]findById[/b](id)
c.name = 'test2'
[company: c]
}
def show(Long id) {
def c = Company.[b]read[/b](id)
c.name = 'testtest'
c.[b]save[/b]()
[company: c]
}
[color=blue]//调用后,数据库不会更新[/color]
def show(Long id) {
def c = Company.[b]read[/b](id)
c.name = 'testtest'
[company: c]
}
def show(Long id) {
def c = Company.[b]get[/b](id)
c.name = 'testtest'
[company: c]
}
def show(Long id) {
def c = Company.[b]findById[/b](id)
c.name = 'test2'
[company: c]
}
def show(Long id) {
def c = Company.[b]read[/b](id)
c.name = 'testtest'
c.[b]save[/b]()
[company: c]
}
[color=blue]//调用后,数据库不会更新[/color]
def show(Long id) {
def c = Company.[b]read[/b](id)
c.name = 'testtest'
[company: c]
}
本文深入探讨了数据库操作中的get、findById、read与save方法的区别,并解释了这些方法调用后对数据库更新的影响。
770

被折叠的 条评论
为什么被折叠?



