<mapping resource="petstore/domain/Product.hbm.xml"/>
这样配置的吗?

解决方案 »

  1.   

    看下 hibernate.cfg.xml  中的 <mapping resource="petstore/domain/Product.hbm.xml"/>中的路径是否正确
      

  2.   

    <class name="petstore.dao.Product" table="products"> 
    这写的是dao一个dao,一个domain,当然不行了!
      

  3.   

    <class name="petstore.dao.Product" table="products"> ...
    Product.hbm.xml路径是和Product.java放在同一个petstore.domain包中
    (@#&%(@#&%(@#&%(@&
    行 就 有鬼了 
      

  4.   

    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"><!-- Generated by MyEclipse Hibernate Tools.-->
    <hibernate-configuration>
    <session-factory>
    <property name="myeclipse.connection.profile">
    com.mysql.jdbc.Driver
    </property>
    <property name="connection.url">
    jdbc:mysql://localhost:3307/petstore
    </property>
    <property name="connection.username">root</property>
    <property name="connection.password">wangzk</property>
    <property name="show_sql">true</property>
    <property name="format_sql">true</property>
    <property name="connection.driver_class">
    com.mysql.jdbc.Driver
    </property>
    <property name="dialect">
    org.hibernate.dialect.MySQLDialect
    </property>
    <mapping resource="petstore/domain/Product.hbm.xml" />
    </session-factory>
    </hibernate-configuration>
    个人认为路径没有问题。请问为什么读不到映射文件的信息?
      

  5.   

    <class name="petstore.dao.Product" table="products"> 
      

  6.   

    <class name="petstore.dao.Product" table="products"> 
    改成
                    petstore.domain.Product改下啊
      

  7.   

    dao?domain?
    唉,都被lz搞糊涂了
      

  8.   

    不好意思,我把<mapping resource="petstore/domain/Product.hbm.xml"/> 改好了,但还是不行唉