Java – use hibernate to delete / delete columns

I am using the Oracle TimesTen 11 database and I have to delete a column from my application I tried to use schemaupdate at first, but it didn't work Then I use the execute method of schemaexport to delete the columns; Although the drop column succeeded, it eventually deleted all records in the table In addition, I use Jar file as input to create / delete / modify tables Please help me solve this problem

Solution

From my point of view, if you want to perform DDL operations from an application, JDBC is your choice The purpose of schemupdate should be to perform synchronization between the business model and the physical structure of the database

edit

I just found that you may update your business model (entity) by deleting fields and wonder why it is not reflected in your database Schemaupdate creates new columns (and tables), but does not delete columns deleted from the entity

EDIT2

It seems that the schema export strategy you are using is not "update", but to delete the existing table and create a new table when creating sessionfactory (see hibernate property hibernate.hbm2ddl.auto, most likely set the value to create drop)

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>