本文整理汇总了Java中org.hibernate.tool.hbm2ddl.Target类的典型用法代码示例。如果您正苦于以下问题:Java Target类的具体用法?Java Target怎么用?Java Target使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Target类属于org.hibernate.tool.hbm2ddl包,在下文中一共展示了Target类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import org.hibernate.tool.hbm2ddl.Target; //导入依赖的package包/类
public static void main(String[] args) {
Configuration hello =new Configuration();
Properties properties = new Properties();
properties.setProperty(Environment.DIALECT, MySQL5Dialect.class.getName());
hello.setProperties(properties);
hello.addAnnotatedClass(Hello.class);
hello.addAnnotatedClass(Hello1.class);
SchemaExport schemaExport = new SchemaExport(hello);
schemaExport.setDelimiter(";");
// schemaExport.setOutputFile(String.format("%s_%s.%s ", new Object[] {"ddl", dialect.name().toLowerCase(), "sql" }));
boolean consolePrint = true;
boolean exportInDatabase = false;
// schemaExport.create(consolePrint, exportInDatabase);
schemaExport.create(Target.SCRIPT);
}
开发者ID:PkayJava,项目名称:pluggable,代码行数:18,代码来源:Hello.java
示例2: testDbSchema
import org.hibernate.tool.hbm2ddl.Target; //导入依赖的package包/类
@Test
public void testDbSchema() {
MetadataSources metadata = new MetadataSources(new StandardServiceRegistryBuilder()
.applySetting("hibernate.dialect", "org.hibernate.dialect.H2Dialect").build());
metadata.addAnnotatedClass(ConsoleEntity.class);
metadata.addAnnotatedClass(GameEntity.class);
metadata.addAnnotatedClass(UserEntity.class);
metadata.addAnnotatedClass(RoleEntity.class);
metadata.addAnnotatedClass(LibraryEntity.class);
metadata.addAnnotatedClass(BorrowEntity.class);
SchemaExport export = new SchemaExport((MetadataImplementor) metadata.buildMetadata());
export.create(Target.SCRIPT);
}
开发者ID:MannanM,项目名称:corporate-game-share,代码行数:16,代码来源:SchemaTranslator.java
示例3: main
import org.hibernate.tool.hbm2ddl.Target; //导入依赖的package包/类
public static void main(String[] args) {
try {
DriverService driverService = CONNECTION_CONFIG.loadDriver();
HibernateDaoContext context = new HibernateDaoContext(driverService, ApplicationConfig.CONFIG);
// Stream.of(context.schemaCreationScript()).forEach(System.out::println);
new SchemaUpdate(context.configuration).execute(Target.SCRIPT);
} catch (Exception ex) {
ex.printStackTrace();
}
}
开发者ID:jonestimd,项目名称:finances,代码行数:11,代码来源:HibernateDaoContext.java
示例4: exportSchema
import org.hibernate.tool.hbm2ddl.Target; //导入依赖的package包/类
@RequestMapping("/admin/schema")
public void exportSchema(final Model model) throws IOException {
final SchemaExport export = new SchemaExport(localSessionFactoryBuilder);
final File f = Files.createTempFile(null, null).toFile();
export.setOutputFile(f.getCanonicalPath());
export.execute(Target.SCRIPT, Type.CREATE);
model.addAttribute("ddl", FileUtils.readFileToString(f));
model.addAttribute("file", f.getCanonicalPath());
}
开发者ID:jegbjerg,项目名称:webapp-base,代码行数:12,代码来源:SchemaController.java
示例5: exportSchemaShouldCreateSqlFile
import org.hibernate.tool.hbm2ddl.Target; //导入依赖的package包/类
@Test
public void exportSchemaShouldCreateSqlFile() {
final SchemaExport export = new SchemaExport(localSessionFactoryBuilder);
export.setOutputFile(OUTPUT_FILE_NAME);
export.execute(Target.SCRIPT, Type.CREATE);
final File f = new File(OUTPUT_FILE_NAME);
assertTrue(f.exists());
}
开发者ID:jegbjerg,项目名称:webapp-base,代码行数:10,代码来源:PersistenceConfigTest.java
注:本文中的org.hibernate.tool.hbm2ddl.Target类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论