Hi,
I'm trying to work with tables from two schemas using the schema generator tool to create the DDL for them. I don't don't if this scenario sounds familiar to anyone:
1. You have a set of common tables you share among several applications.
2. You create a schema for the shared tables (let's call it 'shared') and the schema for each application.
3. A jar file is created with the shared model entities and its map files. This jar will be used by each application that uses the shared files. It includes all the required domain entities, DAOs, etc.
4. You want use Hibernate and the schema generator tool to create the DDL for the application relational model.
So you have a problem:
When you use the schema generator tool, something like:
Code:
<path id="hibernate.classpath">
<pathelement location = "${basedir}/WebContent/WEB-INF/lib/shared.jar" />
</path>
<schemaexport config = "${source.dir}/hibernate_export.cfg.xml"
quiet = "no"
text = "yes"
drop = "no"
delimiter = ";"
output = "schema-export.sql">
<fileset dir="${source.dir}">
<include name="**/*.hbm.xml" />
</fileset>
</schemaexport>
You get an exception: it doesn't find the entities declared in the file shared.jar with the shared entities. They are needed to create the constraints from the application model (they reference entities in the shared schema as properties or collections).
The question is, do you know if you still can use the schema generator to generate the application schema? It needs to 'know' all the map and class files and at the same time generate just the application ones. I find no way to tell this to it.
Any comment would be really welcome.
Best regards,
Juan