I was wondering if it would make sense to allow access to Configuration object that LocalSessionFactoryBean creates internally. See below to see why it is needed.
I was trying to patch the maven hibernate plugin to generate DDL based on spring context and LocalSessionFactoryBean bean instance.
The biggest problem was that LocalSessionFactoryBean clears the ThreadLocal variable that hold DataSource instance. As a result, by the time SchemaExport is executed DataSource has been cleared out.
My hack was to duplicate the LocalDataSourceConnectionProvider inside the plugin so that it uses its own thread local variable rather than LocalSessionFactoryBean's and extract data source through reflection from the dataSource.
Proof of concept hack (cannot even call that mess a patch) against the maven CVS follows.