[hibernate-dev] SchemaExport usage ?

Sanne Grinovero sanne at hibernate.org
Tue May 12 18:55:16 EDT 2015


We have some Hibernate Search tests which use multi-tenancy, and
require the schema to be exported explicitly. I'm trying to get these
to run now with Hibernate ORM 5.

I can't use the command line tool, as the test configuration options
should be passed by instance (there are several unit tests to be run,
each with its own configuration).

I already have a SessionFactory started, so I'd prefer to use its
metadata if possible, but while SchemaExport has plenty of
constructors, it doesn't seem to have one I could use.

This one looks like a good candidate:

 SchemaExport(ConnectionHelper connectionHelper, MetadataImplementor metadata)

as I do have a ConnectionHelper instance. But while I have a reference
to my SessionFactory, and a reference to the Configuration which
started it, I couldn't find a way to get a MetadataImplementor from
these?

Wouldn't it be very useful to have something like

SchemaExport(ConnectionHelper connectionHelper, SessionFactorty sf) ?

I think all multi-tenancy users would need something similar.


Partially unrelated, the methods:
 - org.hibernate.cfg.Configuration.generateDropSchemaScript(Dialect)
 - org.hibernate.cfg.Configuration.generateSchemaCreationScript(Dialect)

are returning an hard coded String[0]. Should these be implemented
before 5.0.0.Final, or are these meant to be deprecated?

Thanks,
Sanne


More information about the hibernate-dev mailing list