Schema export with hibernate annotations

前端 未结 4 1667
萌比男神i
萌比男神i 2021-02-13 12:35

I\'m using hibernate annotations and i want to export my database schema.

Similar to the schemaexporttask with hbm xml files.

4条回答
  •  太阳男子
    2021-02-13 13:04

    You can. Just do it

    AnnotationConfiguration configuration = new AnnotationConfiguration();
    
    configuration
    .addAnnotatedClass(.class)
    .setProperty(Environment.USER, )
    .setProperty(Environment.PASS, )
    .setProperty(Environment.URL, )
    .setProperty(Environment.DIALECT, )
    .setProperty(Environment.DRIVER, );
    
    SchemaExport schema = new SchemaExport(configuration);
    schema.setOutputFile("schema.sql");
    
    schema.create(, );
    

提交回复
热议问题