SchemaExport

前端之家收集整理的这篇文章主要介绍了SchemaExport前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

//自己写映射文件,用myeclipse等生成pojos,把映射文件加到hibernate.cfg.xml里

//然后调用exportTables方法可以生成sql代码

//在数据库中执行代码,pojos就可以使用了

public static void exportTables(){
Configuration con = HibernateSessionFactory.getConfiguration()
.configure("/hibernate.cfg.xml")
//.addClass(JtsAnswer.class)
//.addClass(JtsAsk.class)
//.addClass(JtsHistory.class)
//.addClass(JtsPaper.class)
//.addClass(JtsType.class)
//.addClass(JtsUser.class)
;
new SchemaExport(con).create(true,false);
}

//config中加
<property name="show_sql">true</property>
<property name="connection.username">root</property>
<property name="connection.url">jdbc:MysqL:///jts</property>
<property name="dialect">
org.hibernate.dialect.MysqLInnoDBDialect
</property>

//参照表

DB2 org.hibernate.dialect.DB2Dialect
DB2 AS/400 org.hibernate.dialect.DB2400Dialect
DB2 OS390 org.hibernate.dialect.DB2390Dialect
Postgresql org.hibernate.dialect.PostgresqlDialect
MysqL org.hibernate.dialect.MysqLDialect
MysqL with InnoDB org.hibernate.dialect.MysqLInnoDBDialect
MysqL with MyISAM org.hibernate.dialect.MysqLMyISAMDialect
Oracle (any version) org.hibernate.dialect.OracleDialect
Oracle 9i/10g org.hibernate.dialect.Oracle9Dialect
Sybase org.hibernate.dialect.SybaseDialect
Sybase Anywhere org.hibernate.dialect.SybaseAnywhereDialect
Microsoft sql Server org.hibernate.dialect.sqlServerDialect
SAP DB org.hibernate.dialect.SAPDBDialect
Informix org.hibernate.dialect.InformixDialect
Hypersonicsql org.hibernate.dialect.HsqlDialect
Ingres org.hibernate.dialect.IngresDialect
Progress org.hibernate.dialect.ProgressDialect
Mckoi sql org.hibernate.dialect.MckoiDialect
Interbase org.hibernate.dialect.InterbaseDialect
Pointbase org.hibernate.dialect.PointbaseDialect
FrontBase org.hibernate.dialect.FrontbaseDialect
Firebird org.hibernate.dialect.FirebirdDialect

猜你在找的Postgre SQL相关文章