aspose file tools*
The moose likes Object Relational Mapping and the fly likes Changing POJO class after Domain to Table creation using SchemaExport! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Changing POJO class after Domain to Table creation using SchemaExport!" Watch "Changing POJO class after Domain to Table creation using SchemaExport!" New topic
Author

Changing POJO class after Domain to Table creation using SchemaExport!

Roshni Chandrashekar
Greenhorn

Joined: Jan 14, 2012
Posts: 5
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

Joined: Jan 14, 2012
Posts: 5
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?


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Changing POJO class after Domain to Table creation using SchemaExport!