hibernate的配置表部分内容如下:
<?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>cityHibernate</property>
<property>Java:comp/env/jdbc/test</property>
<property>hibernate_jmzw</property>
<!-- <property>org.hibernate.transaction.WebSphereTransactionManagerLookup</property>-->
<!--<property>org.hibernate.transaction.JBossTransactionManagerLookup</property>-->
<property>java:comp/UserTransaction</property>
<property>jta</property>
<property>org.hibernate.dialect.OracleDialect</property>
<property>50</property>
<property>100</property>
<property>1</property>
<property>true</property>
.......以下的是mapping
</session-factory>
</hibernate-configuration>
新建xml文件,
内容如下:(具体根据实际修改,比如数据源名name="jdbc/test",用户名密码URL等)
<?xml version='1.0' encoding='utf-8'?>
<Context debug="2" displayName="boss1.5_war" docBase="D:/Workspace/test/web" path="/test" reloadable="true" workDir="work\Catalina\localhost\test">
<Resource auth="Container" description="JNDI JDBC DataSource" type="javax.sql.DataSource"/>
<ResourceParams>
<parameter>
<name>maxWait</name>
<value>50000</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>40</value>
</parameter>
<parameter>
<name>password</name>
<value>123456</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@127.0.0.1:1521:SORA</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
<parameter>
<name>username</name>
<value>test</value>
</parameter>
</ResourceParams>
</Context>
扔进%Tomcat%\conf\Catalina\localhost下即可。
就可以了。