我已经粘贴了Hibernate 3配置文件,SessionFactory类来配置这个config.xml和一个带有JPA注释的bean.我想知道我是否正在使用Hibernate 4然后在代码级别的上下文中的变化或非常广泛的差异或外行语言的进步.
的hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@192.168.2.144:1521:xe</property>
<property name="hibernate.connection.username">prateek</property>
<property name="connection.password">prateek</property>
<property name="connection.pool_size">1</property>
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">create</property>
<mapping class="com.vaannila.domain.User1" />
</session-factory>
</hibernate-configuration>
Run Code Online (Sandbox Code Playgroud)
静态java类建立连接(SessionFactory Helper)
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class SessionFactoryHelper {
private static final SessionFactory sessionFactory;
static {
try {
/*
* Build a SessionFactory object from session-factory configuration
* defined in the hibernate.cfg.xml file. In this file we …Run Code Online (Sandbox Code Playgroud) hibernate 3.x 和 4.x 之间的性能有什么区别吗?以及推荐使用什么(我的意思是休眠 4.x 是稳定的)