本文整理汇总了Java中net.sf.hibernate.tool.hbm2ddl.SchemaExport类的典型用法代码示例。如果您正苦于以下问题:Java SchemaExport类的具体用法?Java SchemaExport怎么用?Java SchemaExport使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SchemaExport类属于net.sf.hibernate.tool.hbm2ddl包,在下文中一共展示了SchemaExport类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import net.sf.hibernate.tool.hbm2ddl.SchemaExport; //导入依赖的package包/类
public static void main(String[] args) throws HibernateException , IOException, Exception
{
boolean isToPrintOnConsole = false;
boolean isToExecuteOnDB = false;
if(args.length!=0)
{
String arg = args[0];
if(arg.equalsIgnoreCase("true"))
{
isToPrintOnConsole = true;
isToExecuteOnDB = true;
}
if(arg.equalsIgnoreCase("false"))
{
isToPrintOnConsole = false;
isToExecuteOnDB = false;
}
}
File file = new File("db.properties");
BufferedInputStream stram = new BufferedInputStream(new FileInputStream(file));
Properties p = new Properties();
p.load(stram);
stram.close();
Configuration cfg = new Configuration();
cfg.setProperties(p);
cfg.addDirectory(new File("./WEB-INF/src"));
new SchemaExport(cfg).setOutputFile("catissuecore.sql").create(isToPrintOnConsole, isToExecuteOnDB);
// if(isToExecuteOnDB)
// new GenerateUser();
}
示例2: dropSchema
import net.sf.hibernate.tool.hbm2ddl.SchemaExport; //导入依赖的package包/类
public void dropSchema() throws HibernateException {
new SchemaExport( getConfiguration() ).drop(false, true);
}
示例3: createSchema
import net.sf.hibernate.tool.hbm2ddl.SchemaExport; //导入依赖的package包/类
public void createSchema() throws HibernateException {
new SchemaExport( getConfiguration() ).create(false, true);
}