org.hibernate.hql.ast.QuerySyntaxException: TopicdetailId is not mapped. [from TopicdetailId]
我的hql明明是写成类名的TopicdetailId 了,还是: TopicdetailId is not mapped。
为什么??配置文件:
<hibernate-mapping>
    <class name="com.xiaose.bbs.model.TopicdetailId" table="topicdetail" catalog="bbs">
        <id name="topicid"  type="java.lang.Integer">
         <column name="topicid"></column>
         <generator class="native"></generator>
        </id>
            <property name="forumid" type="java.lang.Integer">
                <column name="forumid" />
            </property>
            <property name="topictitle" type="java.lang.String">
                <column name="topictitle" length="100" />
            </property>
            <property name="topicdate" type="java.util.Date">
                <column name="topicdate" length="19" />
            </property>
            <property name="hits" type="java.lang.Long">
                <column name="hits" />
            </property>
            <property name="postnum" type="java.lang.Integer">
                <column name="postnum" />
            </property>
            <property name="ishighlight" type="java.lang.String">
                <column name="ishighlight" length="1" />
            </property>
            <property name="isbest" type="java.lang.String">
                <column name="isbest" length="1" />
            </property>
            <property name="istop" type="java.lang.String">
                <column name="istop" length="1" />
            </property>
            <property name="isattach" type="java.lang.String">
                <column name="isattach" length="1" />
            </property>
            <property name="author" type="java.lang.String">
                <column name="author" length="40" />
            </property>
            <property name="lastpostauthor" type="java.lang.String">
                <column name="lastpostauthor" length="40" />
            </property>
            <property name="postdate" type="java.util.Date">
                <column name="postdate" length="19" />
            </property>
       
    </class>
</hibernate-mapping>

解决方案 »

  1.   

    不是你hql的问题,是配置映射没对应好。 一个一个检查下看看·
      

  2.   

    那可就说不定了,框架都是人写出来的,肯定会有bug.机器都不能保证100%正确!
      

  3.   

    hibernate没有加载TopicdetailId.xml
      

  4.   

    如果spring 在 sessionFactory 的<property name="mappingResources">
    如果配在hibernate.cfg.xml   <mapping resource="xx/xxTopicdetailId.xml " />
      

  5.   

    在spring 的 sessionFactory 加了<property name="mappingResources">
    ,怎么还报同样的错误?