Hibernate出现Could not find datasource错误

Hibernate出现Could not find datasource错误
Hibernate版本3.2.0beta9a
开发环境Eclipse3.2.1+MyEclipse5+HibernateTools3.2

前几天还好好的程序,今天突然出现Could not find datasource错误。
郁闷了一下午,终于找到了罪魁祸首。

可以正常运行的hibernate.cfg.xml文件:
    <session-factory>
    <property name="show_sql">false</property>
    <property name="connection.datasource">java:comp/env/jdbc/odbcq</property>
    <property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
    <mapping resource="com/tecom/cbd/model/CbdBuilding.hbm.xml" />

    </session-factory>

出现错误的hibernate.cfg.xml文件(MyEclipse5自动生成):
    <session-factory>
    <property name="show_sql">false</property>
    <property name="connection.datasource">java:comp/env/jdbc/odbcq</property>
    <property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
    <property name="jndi.class"></property>
    <property name="connection.password"></property>
    <property name="connection.username"></property>
    <property name="jndi.url"></property>
    <mapping resource="com/tecom/cbd/model/CbdBuilding.hbm.xml" />

    </session-factory>

你可能感兴趣的:(Hibernate出现Could not find datasource错误)