Code example for SchemaExport

0
 
        DataSource dataSource = ctx.getBean(DataSource.class); 
        LocalSessionFactoryBean factoryBean = ctx.getBean(LocalSessionFactoryBean.class); 
        Configuration configuration = factoryBean.getConfiguration(); 
 
        SchemaExport export = new SchemaExport(configuration, dataSource.getConnection()).setDelimiter(";"); 
 
        boolean printDDLToConsole = true; 
        if (args.length > 0) { 
            String outputFile = args[0]; 
            System.out.println("Writing out create statements to " + outputFile); 
            printDDLToConsole = false; 
            export.setOutputFile(outputFile); 
        } 
        export.execute(printDDLToConsole, false, false, true); 
 
        printDDLToConsole = true; 
        if (args.length > 1) { 
            String outputFile = args[1]; 
            System.out.println("Writing out drop statements to " + outputFile); 
Contextual code suggestions in your IDE  Get Codota for Java