-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Using hbm2ddl with a read only view
PostPosted: Thu Aug 12, 2004 9:40 pm 
Regular
Regular

Joined: Wed Jun 30, 2004 4:02 pm
Posts: 64
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.