Grails auto-generate the database from the domain model

三世轮回 提交于 2019-12-24 21:19:23

问题


I am trying to create a simple application using Grails(3.2) and MySQL in Netbeans. I have configured MySql in Grails project and also created a database, named "third" . After creating the domain class model, the controller (scaffolded) and the views for CRUD, my project is running but whenever I am trying to do any operation - screenshot of error

this error is occuring. I am unable to solve this problem and also tried manually creating "Person" table, but same error occuring.


回答1:


Your stacktrace clearly states that your db with name third doesn't have proper table person. But you shouldn't create this table manually (if you already had - please remove all tables from your db)

Connection seems fine but you should take a look at dbCreate value in your application.yml.

dbCreate - Whether to auto-generate the database from the domain model - one of 'create-drop', 'create', 'update' or 'validate'

https://docs.grails.org/latest/guide/conf.html

If you are using just simple command grails run-app to start server, then you should check out the value in the environments: development block.

Paste your application.yml content (without db credentials) if you need a personalized solution.



来源:https://stackoverflow.com/questions/48148396/grails-auto-generate-the-database-from-the-domain-model

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!