Thanks for your response. Here is the code that I have written so far :
Code:
cfg.setProperty("hibernate.dialect", PostgreSQLDialect.class.getName());
cfg.setProperty("hibernate.connection.url", url);
cfg.setProperty("hibernate.connection.username", username);
cfg.setProperty("hibernate.connection.password", password);
cfg.setProperty("hibernate.connection.driver_class", "org.postgresql.Driver");
cfg.setProperty("dbLargeBinaryType", "binary");
cfg.setProperty("hibernate.c3p0.min_size", "1");
cfg.setProperty("hibernate.c3p0.max_size", "10");
cfg.setProperty("hibernate.c3p0.timeout", "1800");
cfg.setProperty("hibernate.c3p0.max_statements", "50");
cfg.setProperty("hibernate.statement_cache.size", "100");
cfg.setProperty("hibernate.transaction.factory_class", "org.hibernate.transaction.JDBCTransactionFactory");
if (recreateNewDatabase) {
cfg.setProperty("hibernate.hbm2ddl.auto", "create-drop");
} else
cfg.setProperty("hibernate.hbm2ddl.auto", "update");
sf = cfg.buildSessionFactory();
We use "create-drop" during fresh-groundup test mode and use "update" during other brief testing modes (that is when we want to retain the same data while we make changes to value objects and re run our applications).
Again, my thinking is that incase we are using "update" mode, then:
1: New Columns will be created, when new Variables are introduced
2: New tables will be created when new classes are introduced
3: Updating / Deleting variable names, not nulls to nulls etc etc should not result in any changes in database, as it would be tough for hibernate to recognize what got changed from past to present. I can understand this limitation.
But atleast #1 and #2 should reflect in update which would help users to to retain the existing data and get into a higher productivity mode.
Is there anyway any one can help me please?
Rahul