-->
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.  [ 7 posts ] 
Author Message
 Post subject: Reveng.xml table-filters does not work.
PostPosted: Wed Jun 15, 2005 4:32 pm 
Beginner
Beginner

Joined: Wed Jun 15, 2005 2:00 pm
Posts: 38
Hi,

I am trying to create an ant task for the cfg2hbm generator.

I tried to configure the filters to filter out the system tables for MS SQL, but it doesn't seem to work.

I end up with a bunch of mapping files for some system tables.

Here's my ant target:

Code:
<target name="generateMappingFromDatabaseTables">
<hibernatetool destdir="../src">
<jdbcconfiguration propertyFile="build_HibernateTools.properties" packagename="project.vo" revengfile="reveng.xml">
</jdbcconfiguration>
<cfg2hbm />
</hibernatetool>
</target>

Here's my reveng.xml

Code:
<hibernate-reverse-engineering>
   <table-filter match-name="*" exclude="true" />
   <table-filter match-name="MM_*" exclude="false" />
</hibernate-reverse-engineering>


WIth this setting, I got the following extra tables:
dtproperties
syssegment
sysconstraints

Strange thing is that there are actually some more system tables in the database that wasn't reversed engineered??

Any ideas where I can download the DTD for the reveng.xml file from? I tried to hit the URL for it, but it gave me a "page cannot be found" error. My context-aware XML editor in Eclipse didn't pick up anything also, since I did not get any hints at all on what attributes and child-elements there are.


Top
 Profile  
 
 Post subject: Reveng File Syntax
PostPosted: Thu Jun 16, 2005 7:45 pm 
Newbie

Joined: Thu Jun 16, 2005 7:38 pm
Posts: 1
I also couldn't find the DTD, but the examples on the tools page use regular expression syntax so .* (dot-star) matches "zero or more occurrences of anything" which is I think what you want, whereas star by itself matches zero or more instances of the previous character. Therefore, MM_* matches MM, MM_, MM__, MM___, etc. but not MM_XYZ. Try it and see if that helps.

_________________
Andrew Jackson
----
First::Class S/w Technologies


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 17, 2005 2:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
rev.eng.xml uses .* and first hit wins.

so your matches does not really match anything so im surprised you dont get the whole db.

note it is not fully regexp (we only support .* in start, beginning and alone) .. at least for now

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 17, 2005 2:17 am 
Beginner
Beginner

Joined: Wed Jun 15, 2005 2:00 pm
Posts: 38
Hi Max,

So do you have any suggestions on how I can only generate mappings only for tables starting with the characters "MM_", e.g. MM_USERS, MM_GROUPS?

I've tried the following but all of them returned me no mappings at all :-(

Code:
<table-filter match-name=".*" exclude="true" />
<table-filter match-name="MM_.*" exclude="false" />

<table-filter match-name=".*" exclude="true" />
<table-filter match-name="^(MM_)" exclude="false" />

<table-filter match-name=".*" exclude="true" />
<table-filter match-name="(MM_)^" exclude="false" />


Are there any documentation available on how to form the expressions for this attribute?

Thanks!

max wrote:
rev.eng.xml uses .* and first hit wins.

so your matches does not really match anything so im surprised you dont get the whole db.

note it is not fully regexp (we only support .* in start, beginning and alone) .. at least for now


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 18, 2005 12:09 am 
Beginner
Beginner

Joined: Wed Jun 15, 2005 2:00 pm
Posts: 38
Hi,

Have figured out the right combination of filters to use, as follows:

Code:
<table-filter match-name="MM_.*" exclude="false" />
<table-filter match-name=".*" exclude="true" />


Seems like you need to put the exclude="false" filters before the exclude="true" statements, i.e. specify the tables you want first, then specify the ones you don't want.

One reason why I don't get the whole database is probably because I'm using a created database account, and not the sa/dbo account, so this account may not have rights to all the system tables.

Thanks to all for the advice and suggestions!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 18, 2005 1:41 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
just remember that first hit wins - no matter if exclude is true or false

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 18, 2005 1:44 am 
Beginner
Beginner

Joined: Wed Jun 15, 2005 2:00 pm
Posts: 38
Yup, noted that :-)

Thanks for your help with this!

Onwards now to the more difficult bits of Hibernate :-) :-)

max wrote:
just remember that first hit wins - no matter if exclude is true or false


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.