Hi, i'm new with Hibernate and i'm looking for a nice way to export my database schema (I used JPA Annotations). I've tried the HibernateToolTask with Ant, and it worked flawlessly. But now i'm wondering if there is a way to use this same tool but from Java code. I've been looking around but i didn't find much about this. Maybe there is another way to do this, or is something useless that only occurred to me and i have to do this from the command line with Ant.
I've tried also with SchemaExport and AnnotationConfiguration, but that way i have to manually put each annotated class.
Looking at the org.hibernate.tool.ant package classes i thought that something like this may work:
HibernateToolTask hibToolTask = new HibernateToolTask();
Hbm2DDLExporterTask schemaExportTask = (Hbm2DDLExporterTask)hibToolTask.createHbm2DDL();
but i was too optimistic.
If someone could help me with this, i would appreciate that.