Perhaps I'm misunderstanding your question (or else you are very much a newbie). To add a column to an existing table without destroying data is done with a simple SQL statement:
ALTER TABLE table_name ADD new_column_name data_type
For example, to add a VARCHAR(100) column called DESC to table FOO:
ALTER TABLE foo ADD desc varchar(100)
Depending on your database you might have different options (VARCHAR2 for Oracle; ADD COLUMN might be required). Check the documentation for your database.
Then just add the additional field to your class, and it's mapping, and restart the app.
If you're wanting to do it dynamically, without an app restart, I don't know how that could be done. But then again, I'm pretty much a Hibernate newbie myself.
|