Announcement Announcement Module
Collapse
No announcement yet.
Programatically refresh database schema Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Programatically refresh database schema

    Hello,

    I've written an incremental update script for my roo app to change some database properties that are not updated when the app starts with SchamaUpdate. I'd like to drop some tables then run schema update again to rebuild them (to clear old constraints, columns, etc and regenerate a fresh table).

    I've googled a bit but I can't work out how to programatically cause SchemaUpdate to run. The closest I get is:

    Code:
    org.hibernate.ejb.Ejb3Configuration cfg = new org.hibernate.ejb.Ejb3Configuration();
    org.hibernate.ejb.Ejb3Configuration configured = cfg.configure(fb.getPersistenceUnitInfo(),  fb.getJpaPropertyMap()); org.hibernate.tool.hbm2ddl.SchemaExport  schemaExport = new org.hibernate.tool.hbm2ddl.SchemaExport(configured.getHibernateConfiguration());
    from here: http://hillert.blogspot.co.uk/2010/0...t-feature.html

    That results in a hibernate exeption that there is no datasource provided, so now I'm stuck. Any suggestions would be great!

    Thanks,
    Mark
Working...
X