-->
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.  [ 3 posts ] 
Author Message
 Post subject: Only reverse engineer from a specific schema?
PostPosted: Fri Sep 09, 2005 3:52 pm 
Beginner
Beginner

Joined: Sun Jun 05, 2005 9:45 am
Posts: 27
The documentation indicates that you can filter the schemas you reverse engineer by using a hibernate.reveng.xml file.

Here is the example in the docs:



Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering SYSTEM "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >

<hibernate-reverse-engineering>

   <type-mapping>
      <sql-type jdbc-type="VARCHAR" length='20' hibernate-type="SomeUserType" /> <!-- jdbc-type is name fom java.sql.Types -->
      <sql-type jdbc-type="VARCHAR" length='1' hibernate-type="yes_no" />
      <sql-type jdbc-type="NUMERIC"  precision='1' hibernate-type="boolean" /> <!-- length, scale and precision can be used to specify the mapping precisly -->
        <sql-type jdbc-type="NUMERIC"  hibernate-type="long" /> <!-- the type-mappings are ordered. This mapping will be consulted last, thus overriden by the previous one if precision=1 for the column -->
   </type-mapping>

   <table-filter match-name="BIN$.*" exclude="true" /> <!-- BIN$ is recycle bin tables in Oracle -->
   <table-filter match-name="DoNotWantIt" exclude="true" /> <!-- Exclude DoNotWantIt from all catalogs/schemas -->
   <table-filter match-catalog="BAD" match-schema="SCHEMA" match-name=".*" exclude="true" /> <!-- exclude all tables from the schema SCHEMA in catalog BAD. -->
   
</hibernate-reverse-engineering>


It looks like you can specify tables/schemas to exclude. Can you use the reverse logic as well? For example, only reverse engineer the tables in the MY_APP_SCHEMA? The documentation on the hibernate.reveng.xml does not go into a lot of detail.

Regards,

Joshua


Top
 Profile  
 
 Post subject: I tried this...
PostPosted: Fri Sep 09, 2005 4:56 pm 
Beginner
Beginner

Joined: Sun Jun 05, 2005 9:45 am
Posts: 27
In an attempt to only reverse engineer tables from MY_SCHEMA, if tried the following:

Code:
<hibernate-reverse-engineering>

   <table-filter match-schema="MY_SCHEMA" exclude="false" />
   <table-filter match-schema=".*" exclude="true" />

</hibernate-reverse-engineering>

Trouble is, it doesn't work.  Suggestions?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 14, 2005 7:39 am 
Newbie

Joined: Wed Sep 14, 2005 7:37 am
Posts: 1
Here is the way I do it (Oracle 9, Hibernate 3):

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering SYSTEM "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >

<hibernate-reverse-engineering>
   <table-filter match-schema="ABSIS" match-name=".*" exclude="false" />
   <table-filter match-schema=".*" match-name=".*" exclude="true" />
</hibernate-reverse-engineering>


I thing the DTD requires a match-name attribute for a table-filter tag.


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

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.