在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 /> </session-factory> </hibernate-configuration>



