//自己写映射文件,用myeclipse等生成pojos,把映射文件加到hibernate.cfg.xml里
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 |