-->
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: SchemaImport
PostPosted: Thu Mar 25, 2004 11:49 am 
Beginner
Beginner

Joined: Tue Mar 23, 2004 4:18 pm
Posts: 45
Hi!

Did somebody write a tool in order to reverse-engineer an existing table and generate the hibernate-mappings (and beans)?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 25, 2004 6:55 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
middlegen

_________________
Emmanuel


Top
 Profile  
 
 Post subject: middlegen
PostPosted: Fri Mar 26, 2004 8:24 am 
Beginner
Beginner

Joined: Fri Mar 26, 2004 8:19 am
Posts: 49
Hi TCN,

Use middlegen reading the directions for the simple example and THEN

1. Modify the database xml file in the samples to point to your datasource.
2. Modify the build.xml file to use the db xml file you just modified.
3. Run middlegen (don't run the create-tables target :-) )
4. You should see the gui. hit generate, then when it seems done, close it.
5. When the generation step is done, run ant hbm2java.

Now you have a set of hbm.xml files and java files that you can use against your database. I used these and the hibernate tutorial on onjava.com to kind of get started.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 27, 2004 2:08 pm 
Beginner
Beginner

Joined: Tue Mar 23, 2004 4:18 pm
Posts: 45
emmanuel wrote:
middlegen


Am I wrong or doesn't middlegen care for foreign keys?


Top
 Profile  
 
 Post subject: Re: middlegen
PostPosted: Mon Mar 29, 2004 8:37 am 
Beginner
Beginner

Joined: Tue Mar 23, 2004 4:18 pm
Posts: 45
toastchee wrote:
Hi TCN,

Use middlegen reading the directions for the simple example and THEN

1. Modify the database xml file in the samples to point to your datasource.
2. Modify the build.xml file to use the db xml file you just modified.
3. Run middlegen (don't run the create-tables target :-) )
4. You should see the gui. hit generate, then when it seems done, close it.
5. When the generation step is done, run ant hbm2java.

Now you have a set of hbm.xml files and java files that you can use against your database. I used these and the hibernate tutorial on onjava.com to kind of get started.


2.5 change name in build.xml :)

Well, I do have a table called "Urls" and the middlegen-generated file are actually called "Url". Why?


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.