-->
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.  [ 5 posts ] 
Author Message
 Post subject: Reverse Engineering Nubie question
PostPosted: Fri Oct 10, 2008 1:10 pm 
Newbie

Joined: Wed Oct 08, 2008 2:44 pm
Posts: 2
Howdy,


I have an existing Oracle database which I would like to reverse engineer. What I want is for a tool to create hbm.xml for each table
in my DB. I have tried to use :
<target name="hbm2hbmxml">
<hibernatetool destdir="generated">
<configuration configurationfile="hibernate.cfg.xml"/>
<hbm2hbmxml/>
</hibernatetool>
</target>

I don't know what to put in hibernate.cfg.xml to tell it to
generate the files for all of my tables. It works if I put

<mapping resource="Person.hbm.xml"/>

but then I'm giving it the Person.hmb.xml file and it then outputs
an Person.hbm.xml file. That doesn't buy me anything.

What should I be doing to generate all of the .hbm.xml files?


thanx


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 14, 2008 6:19 am 
Newbie

Joined: Tue Oct 14, 2008 5:29 am
Posts: 3
Hello grateparty!

You need to check "Hibernate XML Mapping (.hbm.xml)" under "Exporters" of your code generator (toolbarbutton - "Open Hibernate Code Generator Dialog ...").

Another Question:

I want all my generated pojos to extend a common superclass. There is an 'extends'-meta-tag that looks promissing. But I have to write it into each and every single .hbm.xml because its pseudo-inheritance only applies to classes defined in the same .hbm.xml.

Now, since my .hbm.xml are generated as well (actually alongside the java-source in a single operation): How to specify the superclass?

Thanks
Holger

PS: Currently I use a workaround in PojoTypeDeclaration.ftl:
Code:
... ${pojo.getDeclarationName()} extends MySuperClass ${pojo.getExtendsDeclaration()} ...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 17, 2008 2:00 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
grateparty - for ant use <jdbcconfiguration>, look in docs for example.

holgerk - you can specify meta tags in reveng.xml

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 17, 2008 4:03 am 
Newbie

Joined: Tue Oct 14, 2008 5:29 am
Posts: 3
Hello Max!

I've added the meta tag here:
Code:
<table catalog="XXX" name="TABLENAME"
    class="package.MyClass">
  <meta attribute="extends">MySuperClass</meta>
</table>


This works for exactly this one class. But it won't extend to other tables explicitly mapped below ... no "inheritance" here.

Moreover in case of reverse engineering I need this to work for ~ 200 tables implicitly given by the scheme. I really try hard to avoid typing all those table names myself.

For now I stick to my workaround ...

Holger


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 19, 2008 8:24 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you can implement a programmatic reverse engineering strategy and do it without typing 200 times

_________________
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.  [ 5 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.