-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: yet another generateSchemaUpdateScript question
PostPosted: Fri Jan 29, 2010 1:24 am 
Newbie

Joined: Sun Sep 14, 2008 11:37 pm
Posts: 2
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.