php 网站版面素材,网红营销模式有哪些,沛县建设工程交易网,平面设计一个月多少工资ef ddl生成不了脚本好的#xff0c;因此您一直在使用hibernate属性名称“ hibernate.hbm2ddl.auto ” value “ 更新 ”来不断更新数据库模式#xff0c; 但是现在您需要一个完整的DDL脚本吗#xff1f; 从您的Global Class onStart中使用此方法来导出DDL脚本。 只需为其提… ef ddl生成不了脚本 好的因此您一直在使用hibernate属性名称“ hibernate.hbm2ddl.auto ” value “ 更新 ”来不断更新数据库模式 但是现在您需要一个完整的DDL脚本吗 从您的Global Class onStart中使用此方法来导出DDL脚本。 只需为其提供实体的包名称带有路径以及文件名即可 public void onStart(Application app) {exportDatabaseSchema(models, create_tables.sql);}public void exportDatabaseSchema(String packageName, String scriptFilename) {final Configuration configuration new Configuration();final Reflections reflections new Reflections(packageName);final SetClass? classes reflections.getTypesAnnotatedWith(Entity.class);// iterate all Entity classes in the package indicated by the namefor (final Class? clazz : classes) {configuration.addAnnotatedClass(clazz);}configuration.setProperty(hibernate.dialect, org.hibernate.dialect.PostgreSQL9Dialect);SchemaExport schema new SchemaExport(configuration);schema.setOutputFile(scriptFilename);schema.setDelimiter(;);schema.execute(Target.SCRIPT, SchemaExport.Type.CREATE ); // just export the create statements in the script} 这就对了 感谢MonCalamari在这里回答我有关Stackoverflow的问题 。 翻译自: https://www.javacodegeeks.com/2014/10/how-to-use-hibernate-to-generate-a-ddl-script-from-your-play-framework-project.htmlef ddl生成不了脚本