问题
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