• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Changing POJO class after Domain to Table creation using SchemaExport!

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?


 
reply
    Bookmark Topic Watch Topic
  • New Topic