zoukankan      html  css  js  c++  java
  • Hibernate控制台显示创建数据库表语句

     1 package cqvie.yjq.View;
     2 
     3 import org.hibernate.Session;
     4 import org.hibernate.Transaction;
     5 import org.hibernate.cfg.AnnotationConfiguration;
     6 import org.hibernate.tool.hbm2ddl.SchemaExport;
     7 
     8 public class Test {
     9 
    10     public static void main(String[] args) {
    11     
    12         //调用建表语句
    13         exportDDL();
    14         
    15     }
    16 
    17     //建表语句
    18     public static void exportDDL() {  
    19         Configuration configuration = new AnnotationConfiguration().configure();   
    20         SchemaExport sexport = new SchemaExport(configuration);  
    21         sexport.setFormat(true);//格式化输出  
    22           sexport.setDelimiter(";");      //每句sql都以;结尾  不然导入sql的时候会出现错误  
    23         sexport.setOutputFile("D:\auto.sql");  
    24         sexport.create(true, true);  
    25     }  
    26 }
  • 相关阅读:
    windows10装机小记
    Linus Benedict Torvalds hate FUD
    营销文章good
    商城趣聊4
    商城趣聊3
    商城趣聊2
    商城趣聊1
    temp
    学习代码检视方法 (摘自某图片)
    xilinx sdk闪退问题
  • 原文地址:https://www.cnblogs.com/yjq520/p/6119797.html
Copyright © 2011-2022 走看看