bal*_*208 8 hibernate jndi connection-pooling
我需要代码将JNDI名称添加到hibernate中的连接池中.我已经在Jboss服务器中配置了连接池,其JNDI名称为"EmployeeDB"
如何在hibernate.cfg.xml中配置它?
如果我正在使用Hibernate 4 Final版本,Plez会给我hibernate.cfg.xml的代码.
Ken*_*han 14
Jboss服务器中配置的数据源JDNI名称由属性指定hibernate.connection.datasource.
基本hibernate.cfg.xml应该是这样的:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="hibernate.connection.datasource">java:comp/env/jdbc/EmployeeDB</property>
<!-- SQL dialect -->
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- Mapped annotated entity-->
<mapping class="org.hibernate.tutorial.domain.Event"/>
</session-factory>
</hibernate-configuration>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14727 次 |
| 最近记录: |