新建一个 hibernate.cfg.xml 的映射<?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 name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.driver_class">org.gjt.mm.mysql.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/hibernate</property>
<property name="connection.username">username</property>
<property name="connection.password">password</property>
<mapping resource="com/weportal/***/***.hbm.xml"/> </session-factory> </hibernate-configuration>还要在 源文件下建立一个 ***.hbm.xml 的映射
<!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 name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.driver_class">org.gjt.mm.mysql.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/hibernate</property>
<property name="connection.username">username</property>
<property name="connection.password">password</property>
<mapping resource="com/weportal/***/***.hbm.xml"/> </session-factory> </hibernate-configuration>还要在 源文件下建立一个 ***.hbm.xml 的映射
web.xml里面可以配,
spring.xml也可以,还有jndi,
实在不行自己写资源文件,自己去解析!