When I run the example
on my system with mvn tomcat:run command,
Data in mysql tables get's deleted.
So, I had to insert data every time I restart the application.
When I run the example
on my system with mvn tomcat:run command,
Data in mysql tables get's deleted.
So, I had to insert data every time I restart the application.
Assuming you followed the tutorial from the linked page exactly, the reason the MySQL data is being removed each time the application starts can be found in the hibernate.cfg.xml file.
Specifically, it's these lines:
<!-- This will drop our existing database and re-create a new one.
Existing data will be deleted! -->
<property name="hbm2ddl.auto">create</property>
I don't remember what the other values are off the top of my head, but I believe validate will only check that your schema is correct but not change anything. update may also work.