[hibernate-issues] [Hibernate-JIRA] Commented: (HBX-952) some way to generate DDL output

Peter Schröder (JIRA) noreply at atlassian.com
Fri Oct 30 06:47:13 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HBX-952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=34357#action_34357 ] 

Peter Schröder commented on HBX-952:
------------------------------------

i dont think that this ticket is related to an ant task.

i think the problem described here is, that you can put on the show_sql flag of hibernate but you wont see the output from the ddl-statement.

this is due to the usage of SchemaExport in SessionFactoryImpl. 

[...]
   SchemaExport( cfg, settings ).create( false, true );
[...]

Setting the first 'script' parameter (dont know why this is called script when it should be labeled logToStdOut) to false will suppress the logging to the console:

[...]
		if ( script ) {
			System.out.println( formatted );
		}
[...]

the next point i dont understand is, that there is no logger used here?!

we set up a little helper for checking the ddl (the ant-task wont work with our spring-setup):

	@Autowired
	GenericApplicationContext context;

	@Test
	public void generateSchama_success() throws Exception {
		AnnotationConfiguration configuration = new AnnotationConfiguration();
		configuration.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect");
		Class<?>[] annotatedClasses = DaoConfiguration.getAnnotatedClasses();
		for (Class<?> clazz : annotatedClasses) {
			configuration.addAnnotatedClass(clazz);
		}
		SchemaExport exporter = new SchemaExport(configuration);
		exporter.setDelimiter(";");
		boolean script = true; // this flag configures, that the stuff is printed to std-out
		boolean justCreate = true; // ddl for create
		boolean justDrop = false; // ddl for drop
		boolean export = false; // dunno
		exporter.execute(script, export, justDrop, justCreate);
	}

> some way to generate DDL output
> -------------------------------
>
>                 Key: HBX-952
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-952
>             Project: Hibernate Tools
>          Issue Type: Improvement
>          Components: eclipse
>         Environment: Eclipse 3.2.2
> Hibernate Tools beta10
>            Reporter: Dan Allen
>   Original Estimate: 3 days
>  Remaining Estimate: 3 days
>
> After diligent searching, I could not find a way to get the generated DDL for the current hibernate.dialect from the Hibernate Console in Eclipse.  Either this feature isn't available, or it needs to be better documented so that someone can locate its whereabouts.
> What I am looking for is an output that looks like
> CREATE TABLE foo (
>   id bigint(20) unsigned NOT NULL auto_increment
> )
> and so on...
> I would think this would be an "exporter", but no dice.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the hibernate-issues mailing list