This content has been marked as final.
Show 2 replies
-
1. Re: Generate schema based on dynamic configuration
adamw Nov 24, 2009 3:37 AM (in response to obeah)Hello,
I guess you should do something similar to what the EnversHibernateToolTask does. After you have created your configuration object, execute:AuditConfiguration.getFor(configuration);
and then run the schema updates. That should do the trick.
Adam -
2. Re: Generate schema based on dynamic configuration
obeah Nov 24, 2009 6:19 AM (in response to obeah)Hello,
Thank you. It worked after I aslo added a call to configuration.buildMappings before getFor(). Final working code snippet below.configuration = new AnnotationConfiguration(); configuration.addProperties(hibernateProperties); // add resource files for (String resource : allMappingResources) { configuration.addResource(resource); } for(Class<? extends Object> item : allAnnotatedClasses){ configuration.addAnnotatedClass(item); } configuration.buildMappings(); AuditConfiguration.getFor(configuration); SchemaUpdate schemaUpdate = new SchemaUpdate(configuration); schemaUpdate.execute(true, pExecuteScript);