-->
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.  [ 9 posts ] 
Author Message
 Post subject: recursive reverse engineering a small part of a large DB
PostPosted: Fri Jan 21, 2011 10:59 am 
Newbie

Joined: Tue Oct 05, 2010 10:49 am
Posts: 13
Hello,

I have a very large database with which I interact via Hibernate. When changes are made to the database structure I use Hibernate Tools in an Ant script to reverse engineer it, thus generating:
- POJOs
- *.hbm.xml files
- hibernate.cfg.xml

Because the DB is so large [roughly 1500 tables and views => at least 3000 files generated], A full reveng usually takes 8-10 minutes which is way too much time for small changes like a new simple column added to a DB table.

As far as I read the documentation for hibernate tools it is possible to configure hibernate tools to reveng only certain tables with the <table-filter /> directives in hibernate.reveng.xml but the resulted files aren't "valid", for example the relations (many-to-many) aren't generated.

My question is: can hibernate tools be configured in such a manner so that if we would like to reveng only 1 table from the database, it would recursively read/reveng all the dependent tables and generate the proper .hbm.xml files ?

Example:
Table1 depends on Table2 and Table3 via foreign keys, and in the database we would also have Table4,Table5 and Table6.
If I would like to reveng only Table1, the relationships to Table2 and Table3 would not be written.
How cand I configure hibernate tools so it reads Table1, sees that it depends on the aforementioned tables, reads both of them and generates the POJOs and hbm.xml's for all 3, but without reading Table4,Table5 and Table6?
Something like:
Table1
+-->Table2
+-->Table3


And if theoretically Table2 depends on Table5, it should recursively generate the files reading the tables in this order:
Table1
+-->Table2
+-->Table5
+-->Table3

Thank you!


Top
 Profile  
 
 Post subject: Re: recursive reverse engineering a small part of a large DB
PostPosted: Mon Jan 24, 2011 9:03 am 
Senior
Senior

Joined: Fri May 08, 2009 12:27 pm
Posts: 168
I'm not aware of such a facility, and I'd like to have that as well. (I even made a JIRA issue to have all tables mentioned in <table> to be automatically reveng'd - that's a subset of what you want and what I'd like to have as well.)

What worked for me was putting all the relevant tables - main tables, dependent tables, you name it - in <table-filter> directives.


Top
 Profile  
 
 Post subject: Re: recursive reverse engineering a small part of a large DB
PostPosted: Mon Jan 31, 2011 4:10 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Joachim Durchholz wrote:
I'm not aware of such a facility, and I'd like to have that as well. (I even made a JIRA issue to have all tables mentioned in <table> to be automatically reveng'd - that's a subset of what you want and what I'd like to have as well.)

What worked for me was putting all the relevant tables - main tables, dependent tables, you name it - in <table-filter> directives.


This is currently only possible for the case of going from classes to mappings.

This is a feature we want; if you want to contribute to it I can give you pointers to where it should/can be done.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re: recursive reverse engineering a small part of a large DB
PostPosted: Mon Jan 31, 2011 6:10 am 
Senior
Senior

Joined: Fri May 08, 2009 12:27 pm
Posts: 168
max wrote:
This is a feature we want; if you want to contribute to it I can give you pointers to where it should/can be done.


I'd love to, but setting up an Eclipse project for plugin hacking failed because the available project files contained hardcoded filesystem paths, where it was unclear what was supposed to be in those paths.
Also, I wasn't sure I'd be able to properly reconfigure Eclipse for plugin hacking anyway. (I haven't done any plugin work yet.)
Too many risks, too little information&experience&time to minimize them.

However, I'll give it another try if those hurdles can be removed. I'd need:
* A known-to-work (URL with a) list of things to configure/install on top of a "Eclipse IDE for Java Developers" installation (http://www.eclipse.org/downloads/packag ... /heliossr1).
* A download location for an Eclipse project that uses just relative paths.


Top
 Profile  
 
 Post subject: Re: recursive reverse engineering a small part of a large DB
PostPosted: Mon Jan 31, 2011 7:12 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Joachim Durchholz wrote:
max wrote:
This is a feature we want; if you want to contribute to it I can give you pointers to where it should/can be done.


I'd love to, but setting up an Eclipse project for plugin hacking failed because the available project files contained hardcoded filesystem paths, where it was unclear what was supposed to be in those paths.
Also, I wasn't sure I'd be able to properly reconfigure Eclipse for plugin hacking anyway. (I haven't done any plugin work yet.)
Too many risks, too little information&experience&time to minimize them.

However, I'll give it another try if those hurdles can be removed. I'd need:
* A known-to-work (URL with a) list of things to configure/install on top of a "Eclipse IDE for Java Developers" installation (http://www.eclipse.org/downloads/packag ... /heliossr1).
* A download location for an Eclipse project that uses just relative paths.


Which svn url were you using ?

https://anonsvn.jboss.org/repos/hibernate/tools/trunk is the latest trunk and has no .project/.classpath since its a maven project and just imports directly into a plain eclipse with M2eclipse installed.

We are still working out some glitches in the still "Raw" pom.xml but for just importing it into eclipse it "just worked" when I imported it.

Let me know and if it doesn't work.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re: recursive reverse engineering a small part of a large DB
PostPosted: Mon Jan 31, 2011 7:36 am 
Senior
Senior

Joined: Fri May 08, 2009 12:27 pm
Posts: 168
max wrote:
Which svn url were you using ?


Hey, that's been a year ago :-)

max wrote:
https://anonsvn.jboss.org/repos/hibernate/tools/trunk is the latest trunk and has no .project/.classpath since its a maven project and just imports directly into a plain eclipse with M2eclipse installed.


I guess that I was missing M2eclipse.

What plugins are needed to convert a vanilla Java-SE-programming Eclipse into a plugin-hacking Eclipse? (Maybe none, I don't know, but currently I suppose some tool support would be helpful or even necessary.)
Once that's installed: How do I start the debugger for the plugin I'm hacking? After all, I'd have Hibernate Tools twice, the production version from the distribution and the hacking version from SVN.


Top
 Profile  
 
 Post subject: Re: recursive reverse engineering a small part of a large DB
PostPosted: Mon Jan 31, 2011 7:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Joachim Durchholz wrote:
max wrote:
Which svn url were you using ?


Hey, that's been a year ago :-)

max wrote:
https://anonsvn.jboss.org/repos/hibernate/tools/trunk is the latest trunk and has no .project/.classpath since its a maven project and just imports directly into a plain eclipse with M2eclipse installed.


I guess that I was missing M2eclipse.

What plugins are needed to convert a vanilla Java-SE-programming Eclipse into a plugin-hacking Eclipse? (Maybe none, I don't know, but currently I suppose some tool support would be helpful or even necessary.)
Once that's installed: How do I start the debugger for the plugin I'm hacking? After all, I'd have Hibernate Tools twice, the production version from the distribution and the hacking version from SVN.


None of this code is using eclipse plugins - all of this is just for hibernate tools core - nothing eclipse specific.

If you want to expand/work on the eclipse plugins - that's doable too; but the handling of reverse engineering is 99% hibernate tools core ;)

If you want to do the eclipse plugins that is https://anonsvn.jboss.org/repos/jbosstools/trunk (a *much* larger checkout, just so you are warned)
When done - import the hibernatetools subtree into eclipse and when you launch it will replace your "production" version.

If you have Eclipse SDK + Eclipse WTP SDK installed you got all the bits and pieces needed to build and develop on hibernate tools.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re: recursive reverse engineering a small part of a large DB
PostPosted: Mon Jan 31, 2011 7:53 am 
Senior
Senior

Joined: Fri May 08, 2009 12:27 pm
Posts: 168
I'd need to use the plugin to test any changes in tools, no?

... well of course I could do something with the Ant task, but I'd have to keep two configurations in sync, the productive Tools-based one and the Ant-based one.

Anyway. Plug-ins it is, I lack the time to switch our productive environment to Reveng-via-Ant.

I'll give it all a try next week, maybe end of this week - we're currently in crunch mode.


Top
 Profile  
 
 Post subject: Re: recursive reverse engineering a small part of a large DB
PostPosted: Mon Jan 31, 2011 8:08 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Joachim Durchholz wrote:
I'd need to use the plugin to test any changes in tools, no?

... well of course I could do something with the Ant task, but I'd have to keep two configurations in sync, the productive Tools-based one and the Ant-based one.

Anyway. Plug-ins it is, I lack the time to switch our productive environment to Reveng-via-Ant.

I'll give it all a try next week, maybe end of this week - we're currently in crunch mode.


okey - btw. fastest way to get our attention is on #jbosstools irc and jboss tools forums.

_________________
Max
Don't forget to rate


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