Hibernate version: 2.1.4
I have my application's schema all set and mapped with hibernateDoclet->.hbm.xml files -> Generated DDL
I need to interface with several read only views from seperate schemas.
I created the object, set mutable="false" at the class level, had to create an id, so set generator="assigned"
I could not find a way to tell hibernateDoclet that I did not want to generate this table. So, I then tried to exlude the single hbm.xml file in my ant task:
Code:
<target name="generate-schema" depends="maketarget" description="Generate DB schema from the O/R mapping files">
<mkdir dir="${sql_scripts}"/>
<!-- Teach Ant how to use Hibernate's schema generation tool -->
<taskdef name="schemaexport"
classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="project.classpath"/>
<schemaexport properties="${classes}/hibernate.properties"
quiet="no" text="no" drop="no" output="../${sql_scripts}/srt_schema.ddl">
<fileset dir="${classes}" includes="**/*.hbm.xml" excludes=""/>
</schemaexport>
</target>
When I specified the hbm to exclude I got an error (to be expected now that I think about it) that one of my hbm's referenced the hbm that could no longer be found.
So for now, I have to generate the DDL, and edit it to remove the table that is really a view.
What is the best practice here? Should I even create a standard hibernateDoclet mapping for the view, or is this a limitation in the current tool?
Thanks,
Ted