hibenate+proxool安装
这是hibnate.cfg.xml文件的内容
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.provider_class">org.hibernate.connection.ProxoolConnectionProvider</property>
<property name="hibernate.proxool.pool_alias">DBPool</property>
<property name="hibernate.proxool.xml">Proxool</property>
<property name="hibernate.proxool.existing_pool">true</property>
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<mapping resource="hibernate.cfg.xml"/>
<mapping resource="Proxool.xml"/>
<mapping resource="wnSanatoriumDatabaseObject/TongxinUserprop.hbm.xml"/>
</session-factory>
<!-- <session-factory >
local connection properties
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/tianliao315?characterEncoding=UTF-8</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password"></property>
property name="hibernate.connection.pool_size"></property
dialect for DB2
<property name="dialect">org.hibernate.dialect.DB2Dialect</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<mapping resource="wnSanatoriumDatabaseObject/TongxinUserprop.hbm.xml"/>
<mapping resource="Proxool.xml.xml"/>
</session-factory> -->
</hibernate-configuration>
Proxool.xml代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<something-else-entirely>
<proxool>
<alias>DBPool</alias>
<driver-url>
jdbc:mysql://localhost:3306/tianliao315?characterEncoding=UTF-8
</driver-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver-properties>
<property name="user" value="root"/>
<property name="password" value=""/>
</driver-properties>
<house-keeping-sleep-time>90000</house-keeping-sleep-time>
<maximum-new-connections>20</maximum-new-connections>
<prototype-count>5</prototype-count>
<maximum-connection-count>300</maximum-connection-count>
<minimum-connection-count>10</minimum-connection-count>
</proxool>
</something-else-entirely>
jar包图
最后报错
main中代码
TongxinUserprop tongxinUserprop=new TongxinUserprop();
TongxinUserpropPK tongxinUserpropPK=new TongxinUserpropPK();
tongxinUserpropPK.setUsername("1112");
tongxinUserpropPK.setName("2222");
tongxinUserprop.setId(tongxinUserpropPK);
tongxinUserprop.setPropvalue("3333");
Configuration cfg = new Configuration();
SessionFactory sf = cfg.configure().buildSessionFactory();
// Session session = sf.openSession();
Session session=sf.openSession();
session.beginTransaction();
session.save(tongxinUserprop);
session.getTransaction().commit();
session.close();
sf.close();
System.out.print("success!");
可是总是报错
Error parsing XML (2) : cvc-elt.1: Cannot find the declaration of element 'something-else-entirely'.