4
방금 Grails 학습을 시작했고 grails 콘솔을 사용하여 데이터베이스를 가지고 놀고 싶지만 grails console
과 grails
를 실행 한 후 console
:"grails console"과 "grails"의 차이점, "console"
터미널에서 바로 grails console
을 시작할 때 :
~/Desktop/Grails-lab/racetrack $ grails console
| Compiling 1 source files.....
을 console
에서 :
groovy> import racetrack.*
groovy> def z = new User(userName:"bangkuangwang",fullName:"noge noge",website:"noge.com",email:"[email protected]",bio:"hello world",password:"123123")
groovy> z.save()
groovy> println(z.errors)
groovy> User.count
grails.validation.ValidationErrors: 0 errors
Result: 1
console
에서
~/Desktop/Grails-lab/racetrack $ grails
| Enter a script name to run. Use TAB for completion:
grails> console
| Compiling 1 source files.....
: 다음 console
grails
사용하여 시작, Grails는 다르게 행동 콘솔 시작의 2 가지 방법이 왜
groovy> import racetrack.*
groovy> def z = new User(userName:"bangkuangwang",fullName:"noge noge",website:"noge.com",email:"[email protected]",bio:"hello world",password:"123123")
groovy> z.save()
groovy> println(z.errors)
groovy> User.count
Exception thrown
groovy.lang.MissingMethodException: No signature of method: racetrack.User.save() is applicable for argument types:() values: []
Possible solutions: save(), save(boolean), save(java.util.Map), wait(), last(), any()
at com.springsource.loaded.ri.ReflectiveInterceptor.jlrConstructorNewInstance(ReflectiveInterceptor.java:963)
at racetrack.User.save(User.groovy)
at racetrack.User$save.call(Unknown Source)
at ConsoleScript0.run(ConsoleScript0:3)
at com.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1231)
at com.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1231)
누군가가 나에게 설명 할 수 있습니까?