• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Changing POJO class after Domain to Table creation using SchemaExport!

 
Roshni Chandrashekar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

We are trying to create database tables from our already existing domain Pojo classes and I am using SchemaExport to create them. Problem is, If I change the pojo class like adding a new attribute (enumStatus) after table creation and run it, I am getting Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'enumStatus' in 'field list' error. I am using the schema export as se.execute(true, true, false, true); so that when the app runs, existing tables are not dropped and the data is not lost. Below is the sample code I have been trying to execute. Please advice on how to avoid this error and facilitate future changes to the POJOs.


hibernate.cfg.xml:


Person.java:


FulltimeEmployee.java


ContractEmployee.java


Main.java:


Error stack trace:



Thanks
 
Roshni Chandrashekar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, If I delete the existing tables and run it, even then it wont work. Gives me error. Only if I comment out the below in the main class its working .

Any idea why?


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic