-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Named Query Issue
PostPosted: Fri Dec 12, 2008 3:44 pm 
Newbie

Joined: Fri Dec 12, 2008 3:29 pm
Posts: 1
I have a named query that will not compile. I receive the following error: Errors in named queries: UserComment.findCommentToPages.
Note that I have jUnit tested all the mappings and all tests are successful, which means there is something wrong with my named query.
The named query is below:
Code:
 
<query name="findCommentToPages">
            <![CDATA[from UserComment uc join uc.commentToPages pageComments with pageComments.pageInfo.pageInfoID.eventID = :eventID and pageComments.pageInfo.pageInfoID.pageID = :pageID]]>
        </query>


From debugging the query, the code that breaks it is after the
Code:
with


So let me show you the mappings for
Code:
pageComments, and pageInfo


Code:
pageComments
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.domain.comment">
    <class name="UserCommentToPage" table="UserCommentToPage" schema="C3">
        <id name="userCommentToPageSynID" type="integer" column="UserCommentToPageSynID">
            <generator class="identity" />
        </id>
        <many-to-one name="userComment"
                     class="UserComment"
                     column="UserCommentID"
                     foreign-key="FK_UsrCmntToPage_To_UsrCmnt"/>
        <many-to-one name="pageInfo"
                  class="com.connect3.domain.proof.PageInfo"
                  foreign-key="FK_UsrCmntToPage_To_PageInfo">
                        <column name="EventID"></column>
                        <column name="PageID"></column>               
        </many-to-one>
        <!-- Queries -->
      
    </class>
</hibernate-mapping>


Code:
pageInfo
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">


<hibernate-mapping package="com.domain.proof">
    <class name="PageInfo" table="PageInfo" schema="C3">
         <composite-id class="PageInfoID">
                <key-property name="eventID" column="EventID" access="field"/>
                <key-property name="pageID" column="PageID" access="field"/>
       </composite-id>
        <version name="version" access="field" unsaved-value="negative">
            <column name="ObjVersion" not-null="true" default="0" check="ObjVersion &gt;= 0"/>
        </version>
        <many-to-one name="pageTemplate"
                     class="PageTemplate"
                     column="PageTemplateID"
                     not-null="true"
                     foreign-key="FK_PgInf_To_PgTmplt"/>
        <many-to-one name="pageStatus"
                     class="PageStatusList"
                     column="PageStatusID"
                     not-null="true"
                     foreign-key="FK_PgInf_To_PgStatLst"/>
        <property name="seqno" type="integer" column="seqNo"/>
        <!-- We are not using the NoteText anymore
        <property name="noteID" type="integer" column="NoteID" />
        -->
        <property name="pageName"
                  type="string"
                  column="PageName"
                  not-null="true"
                  length="20"/>
        <property name="printType" type="string" column="PrintType" length="25"/>
        <property name="description"
                  type="string"
                  column="Description"
                  not-null="true"
                  length="250"/>
        <property name="reload" type="true_false" column="Reload" not-null="true"/>
        <property name="complete" type="true_false" column="Complete" not-null="true"/>
        <property name="isLock" type="true_false" column="IsLock" not-null="true"/>
    </class>
</hibernate-mapping>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.