-->
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.  [ 4 posts ] 
Author Message
 Post subject: Creating DDL Schemas using a class instead of an Ant
PostPosted: Thu Jun 29, 2006 8:55 am 
Beginner
Beginner

Joined: Thu Jun 29, 2006 8:41 am
Posts: 41
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Hi,

I'm new to the forums and kinda new to the Hibernate. After reading a bit about it in Hibernate in Action book and about the HBM2DDL tool, I decided to come here in hope for a tip.

What I need to do is build a java class that uses SchemaExport to build the DDL schemas instead of using an ant to do the job.

Actually, I think I need a class that works like SchemaExport, but does the job without needing an ant.

So, basically I need to know if there's anything like that done already so that I can check out or if there's any tips (including places to go check by myself) you guys could share with me.

_________________
Falci - Heavy Worker!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 29, 2006 12:04 pm 
Beginner
Beginner

Joined: Wed Sep 21, 2005 11:52 am
Posts: 43
Ant is just java so AFAIK you should be able to use the classes that implement the ant task directly in your code.

If you have the hibernate source download then look at the source for SchemaExport and SchemaExportTask in the package org.hibernate.tool.hbm2ddl.

Good luck.

Larry

Don't forget to rate.


Top
 Profile  
 
 Post subject: Re: Creating DDL Schemas using a class instead of an Ant
PostPosted: Fri Jun 30, 2006 9:02 am 
Beginner
Beginner

Joined: Tue Aug 26, 2003 2:46 pm
Posts: 45
Location: Saskatoon SK Canada
Falci wrote:
What I need to do is build a java class that uses SchemaExport to build the DDL schemas instead of using an ant to do the job.

Actually, I think I need a class that works like SchemaExport, but does the job without needing an ant.


SchemaExport can be used from code. I use the following in my application to build the database. Is this what you're looking for?

Code:
        new SchemaExport(configuration).create(false, true);

_________________
Maury


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 01, 2006 1:29 pm 
Beginner
Beginner

Joined: Thu Jun 29, 2006 8:41 am
Posts: 41
Sorry for not coming back earlier, but I solved the problem by myself. Thanks for the answers.

I kinda figured it out once my boss explained me exactly what I had to do.

I thought I had to reinvent the wheel or something... :P

The fact is I really just needed to use the SchemaExport Class. Like you said. Hibernate in Action was enough to give me this answers so I didn't come back earlier.

Thanks for the answers again. :)

_________________
Falci - Heavy Worker!


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