Using SchemaExport in playFramework

35 views
Skip to first unread message

Giuseppe Annunziata

unread,
Jul 16, 2013, 7:14:47 AM7/16/13
to pla...@googlegroups.com

On Play Framework 1.2.5 with Jpa+Hibernate as ORM, I would like to call programmatically Hibernate tool SchemaExport. I tried this code:

Ejb3Configuration cfg = getPlayEjb3Configuration();
Configuration configuration = cfg.getHibernateConfiguration();
try {
   SchemaExport se = new SchemaExport(configuration);
   se.setHaltOnError(true);
   se.setDelimiter(";").setFormat(true);
   se.execute(true, false, false, false);
}
catch(Exception e) {
 
}

Where getPlayEjb3Configuration() is a "copy" of play framework JPAPlugin.onApplicationStart().

I always obtain a 'no datasource provided' exception message. I try to preserve ejb3 configuration in a static reference (modifying play framework) with no difference in result.

What I do wrong?

Reply all
Reply to author
Forward
0 new messages