-->
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.  [ 6 posts ] 
Author Message
 Post subject: DDL generator
PostPosted: Fri Nov 11, 2005 9:33 am 
Newbie

Joined: Sat Nov 05, 2005 8:59 pm
Posts: 16
Hi,
I use JSR220ORM plug-in for eclipse to create ddl file but there are lots of bugs in ddl file, is there another tool for generating DDL?Any tips would be appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 12, 2005 12:48 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
If you like ant, take a look at hbm2ddl at http://www.hibernate.org/hib_docs/tools/ant/index.html

If you would rather generate the DDL with manual java, try something like this:

Code:
   conf = new Configuration().configure(onlyDifference);
   sessionFactory = conf.buildSessionFactory();
       SchemaExport schemaExport = new SchemaExport(conf);
       schemaExport.create(true, true);


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 12, 2005 7:52 pm 
Newbie

Joined: Sat Nov 05, 2005 8:59 pm
Posts: 16
Thank you for your help. But i can not launch the ant tool (hibernate-tool) successfully. It seems that this tool depends on specified version of hibernate-annotation.jar, persistence.jar and hibernate.jar. And the linked page does not give any hint about which version should i use. :( After lots of NotFoundClass, NotFoundMethode i give up this approach.

Now i try to use manual codes to generate DDL, but i have also no idea how to begin :( Should i use AnnotationConfiguration or something like this?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 12, 2005 8:02 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
your dependency issues should go away as long as you are using the hibernate.jar that is packaged w/ whatever distribution you got the tools from (hibernate-tools.jar ) .

if you are set on the SchemeExport way, you'll need AnnotationConfiguration if the mappings are in annotations, although you can use AnnotationConfiguration w/ an annotationless mapping model.

take a look at this for SchemaExport info

http://www.hibernate.org/hib_docs/v3/ap ... xport.html


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 12, 2005 9:00 pm 
Newbie

Joined: Sat Nov 05, 2005 8:59 pm
Posts: 16
Yes, after using all the jar from hibernate-tools/lib, my dependency problem is resolved. :) But now i encounter a new one. The generated DDL file is empty.http://forum.hibernate.org/viewtopic.php?t=950014.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 13, 2005 12:17 am 
Newbie

Joined: Sat Nov 05, 2005 8:59 pm
Posts: 16
Thank you dennis, i have created the ddl using simple manual codes by schemaExport. It is very simple.

Code:
AnnotationConfiguration cfg = (AnnotationConfiguration)
      new AnnotationConfiguration().configure(new File("hibernate.cfg.xml"));
      SchemaExport schemaExport = new SchemaExport(cfg);
      schemaExport.setOutputFile("test.ddl").create(true,false);;


I am a newbie of hibernate, your information helped me a lot.:))


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