I have the following code: [code] AnnotationSessionFactoryBean sf = (AnnotationSessionFactoryBean)this.applicationContext.getBean("&txSessionFactory"); Properties properties = sf.getHibernateProperties(); Session session = getTxSessionFactory().openSession(); Dialect dialect = Dialect.getDialect(properties); Connection connection = session.connection(); DatabaseMetadata meta = new DatabaseMetadata(connection, dialect); Configuration config = sf.getConfiguration(); String[] creationScript = config.generateSchemaCreationScript(dialect); String[] updateScript = config.generateSchemaUpdateScript(dialect,meta); [/code] I have the session factory configured (and working) in Spring so I'm confident about that part. I'm pulling the configuration info from the session factory so I end up with a Hibernate configuration. From there I call generateSchemaCreation which works just fine. I get a load of DDL strings in the creationScript.
But when I call generateSchemaUpdateScript I get nothing. Okay, maybe I have an up to date schema? Well I compared the creationScript with the database I am pointing to and the creationScript has the extra tables and fields I was hoping to see in the updateScript, but they are not present on the database.
Note that I just want the script. I don't want it to update the schema directly. No errors are showing and I was earlier getting an error saying I needed a db connection, so I guess is is connecting now, it isn't saying it fails to connect anyway. The config has a mix of hbm and annotations (older tables are hbm). They all showed in the creationScript.
Hibernate v 3.3.1 GA
My properties file looks like this: [code] hibernate.connection.isolation=REPEATABLE_READ hibernate.connection.pool_size=20 hibernate.hbm2ddl.auto=none hibernate.dialect=org.hibernate.dialect.OracleDialect hibernate.show_sql=false hibernate.cache.provider_class=org.hibernate.cache.NoCacheProvider hibernate.cache.use_second_level_cache=false hibernate.cache.use_query_cache=false hibernate.cache.use_minimal_puts=false hibernate.max_fetch_depth=3 [/code]
Database is Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
Thanks for any help.
|