利用hibernat包:实体类,配置文件可以在数据库创建表
get和load的区别?
GET马上加载
LOAD迟延加载!!
package com.bjsxt.hibernate;
import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;
public class ExportDB {
public static void main(String[] args) {
//读取配置文件
Configuration cfg = new Configuration().configure();
//创建SchemaExport对象
SchemaExport export = new SchemaExport(cfg);
//创建数据库表
export.create(true,true);
}
}
get和load的区别?
GET马上加载
LOAD迟延加载!!