首先看一下构建configuration:
区别于XML下构建configuration的模式:
new Configuration()默认读取的是hibernate.properties,所以如果需要读取hibernate.cfg.xml文件的话,可以使用new Configuration().configure(),同时如果需要获取其他文件名称的文件资源,也可以使用new Configuration()提供的API来设置。
hibernate.cfg.xml配置范例如下:
一个关于Hibernate Identity Generator的范例:
生成策略采用TABLE