Reputation: 41
I am using Oracle Timesten 11 DB and I have to drop a column from my application. I tried using SchemaUpdate in the beginning but it didn't work. Then I used SchemaExport's execute method to drop the column; Though the drop column was succesful, it ended up deleting all the records in the table. Also, I am using a .jar file as input to do create/delete/modify tables. Kindly help me fixing this issue.
Upvotes: 4
Views: 5576
Reputation: 3679
From my perspective JDBC is the way to go if DDL operations are what you want to perform from your application. SchemaUpdate's purpose should be performing synchronization between your business model and database physical structure.
EDIT
Just now figured out that you probably updated your business model (entities) by removing field(s), and are wondering why it isn't reflected on your DB. SchemaUpdate will create new columns (and tables) but it will not drop those removed from your entities.
EDIT2
Then I used SchemaExport's execute method to drop the column; Though the drop column was succesful, it ended up deleting all the records in the table.
It seems that you used schema export strategy that doesn't 'update', instead it drops existing tables and creates new ones when SessionFactory gets created (see Hibernate property hibernate.hbm2ddl.auto
, most likely value was set to create-drop
).
Upvotes: 1