drop a column from table

#1

Hi,

I want to drop one column from my database table suppose i have 3 column (id, name, address) now i want to drop address. then what will be the query or procedure..

 

bimal kumar dalei
#2

Just remove the field from the entity class. See Automatic Schema Evolution.

Space in the database file will be reclaimed lazily, for every entity object on its next committed change.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#3

Hi

But it physically present and logically it will not display. If a want to drop or delete a column permanently then what will be the procedure.

bimal kumar dalei
#4

Because the data is physically removed only when an object is stored again, after removing the field from the entity class you will have to iterate over all the relevant objects, mark them as dirty within an active transaction (either by calling makeDirtymakeDirty(pc, fieldName)JDOHelper's static methodExplicitly mark the parameter instance and field dirty.See JavaDoc Reference Page... or by setting one of their persistent fields), and of course commit the transaction.

Alternatively, you run the Doctor in repair mode to create a new database file. The schema change must be available to the Doctor, so you must open the database after the schema change in your application to register the change, or run the Doctor with a classpath that contains your entity classes.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login