<?xml version="1.0" encoding="GB2312"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<!--
java:hibernate/SessionFactory/ 部分必须保留 在后边填写软件名称
程序会更具软件名称来调用
-->
<session-factory name="java:hibernate/SessionFactory/JWebBox">
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">
<![CDATA[jdbc:mysql://localhost:3306/jwebbox?useUnicode=true&characterEncoding=GBK]]>
</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">519420</property>
<!-- configuration pool via c3p0 连接池配置 -->
<property name="hibernate.c3p0.acquire_increment">2</property>
<property name="hibernate.c3p0.max_size">10</property>
<property name="hibernate.c3p0.min_size">1</property>
<property name="hibernate.c3p0.max_statements">0</property>
<property name="hibernate.c3p0.timeout">100</property> <!-- seconds -->
<property name="hibernate.c3p0.idle_test_period">3000</property> <!-- seconds -->
<!-- DEPRECATED very expensive property name="c3p0.validate 连接池配置 --> </session-factory>
</hibernate-configuration>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<!--
java:hibernate/SessionFactory/ 部分必须保留 在后边填写软件名称
程序会更具软件名称来调用
-->
<session-factory name="java:hibernate/SessionFactory/JWebBox">
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">
<![CDATA[jdbc:mysql://localhost:3306/jwebbox?useUnicode=true&characterEncoding=GBK]]>
</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">519420</property>
<!-- configuration pool via c3p0 连接池配置 -->
<property name="hibernate.c3p0.acquire_increment">2</property>
<property name="hibernate.c3p0.max_size">10</property>
<property name="hibernate.c3p0.min_size">1</property>
<property name="hibernate.c3p0.max_statements">0</property>
<property name="hibernate.c3p0.timeout">100</property> <!-- seconds -->
<property name="hibernate.c3p0.idle_test_period">3000</property> <!-- seconds -->
<!-- DEPRECATED very expensive property name="c3p0.validate 连接池配置 --> </session-factory>
</hibernate-configuration>
java:hibernate/SessionFactory/ 部分必须保留 在后边填写软件名称
程序会更具软件名称来调用这个是我的软件的,忘记删除了,不用管
能给出全部的文件吗?而且这个例子好象太复杂了,有简单点的吗?
如果你要简化配置可以这样<?xml version="1.0" encoding="GB2312"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="java:hibernate/SessionFactory/JWebBox">
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">
<![CDATA[jdbc:mysql://localhost:3306/jwebbox?useUnicode=true&characterEncoding=GBK]]>
</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">519420</property>
</session-factory>
</hibernate-configuration>
你在程序中使用下边代码就可以得到SessionFactory SessionFactory sf = (SessionFactory)SessionFactoryObjectFactory.getNamedInstance("java:hibernate/SessionFactory/JWebBox");
http://www.javawebstudio.com/html/J2005/j05_New_7.htm