1
안녕하세요이 도메인 클래스 사용자 및 나 자신은 내가 프로젝트를 실행 people.When 등록하고 나는이 오류를 얻을 입력 필드를 눌러 입력 컨트롤러 생성 :누락 된 테이블
org.springframework.jdbc.BadSqlGrammarException: Hibernate operation: could not extract ResultSet; bad SQL grammar [n/a]; nested exception is
org.postgresql.util.PSQLException: ERROR: column this_.id does not exist
에는 연결을 postgresql. 나는 다른 모든 도메인 클래스가 데이터베이스에 자신의 테이블을 가지고 있지만 도메인 클래스가이 오류가 발생하는 이유라고 생각하지 않는다. 어떻게 해결할 수 있습니까?
class User {
String login
String password
String name
static constraints = {
login size: 3..20 , unique: true, nullable: false
password size: 3..20, unique: false, nullable: false
name size: 3..20, unique: false, nullable: false
}
}
class UserController {
def scaffold = User
def login = {}
def authenticate = {
def user = User.findByLoginAndPassword(params.login, params.password)
if(user){
session.user = user
flash.message = "Hello ${user.name}!"
redirect(controller:"entry", action:"list")
}else{
flash.message = "Sorry, ${params.login}. Please try again."
redirect(action:"login")
}
}
def logout = {
flash.message = "Goodbye ${session.user.name}"
session.user = null
redirect(controller:"entry", action:"list")
}
}
class RegisterUserController {
def index() { }
def register(String user,String password,String name) {
def user2=new User(login: user,password : password,name: name)
if (user2.validate() && user2.save()) {
redirect(url: "http://localhost:8080")
} else {
}
}
}
난에 오류가 발생합니다 : 만약 (user2.validate() & & user2.save())
application.yml 파일을 필요에이
hibernate:
cache:
queries: false
use_second_level_cache: true
use_query_cache: false
region.factory_class: org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
dataSource:
pooled: true
jmxExport: true
driverClassName: org.postgresql.Driver
username: postgres
password:
environments:
development:
dataSource:
dbCreate: create-drop
url: jdbc:postgresql://localhost:5432/new
username: postgres
password:
test:
dataSource:
dbCreate: update
url: jdbc:postgresql://localhost:5432/new
username: postgres
password:
production:
dataSource:
dbCreate: update
url: jdbc:postgresql://localhost:5432/new
username: postgres
password:
도메인 정보를 입력하십시오. 이 정보를 통해 왜 예외가 발생하는지 정확한 이유를 알 수 없습니다. –
그리고 Config.groovy (또는 application.yml) plz를 제공하십시오. – Joch
아마 모든 새 도메인 클래스 테이블을 다시 만들려면 application.yml 설정에서 뭔가를 변경해야합니까? –