[hibernate-dev] SchemaExport usage ?

Steve Ebersole steve at hibernate.org
Wed May 13 00:05:13 EDT 2015

None of the bootstrapping contracts are kept around after the SF is
bootstrapped.  Nothing different there from Configuration.  There is
nothing meaningful on SessionFactory for performing any schema tools.  For
what its worth I hope to change that with the metamodel work (6.0), but for
now this is the case.

The Configuration methods should be removed.  I just missed them.

Take a look
at org.hibernate.test.multitenancy.schema.SchemaBasedMultiTenancyTest in
regards to how I do this for my tests

On Tue, May 12, 2015 at 5:55 PM, Sanne Grinovero <sanne at hibernate.org>

> 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
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev

More information about the hibernate-dev mailing list