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.  [ 2 posts ] 
Author Message
 Post subject: Help! Named query not known exception
PostPosted: Tue Jul 05, 2005 10:41 pm 
Newbie

Joined: Tue Jun 28, 2005 4:26 pm
Posts: 5
Hey all,

Perhaps someone can help me with this problem.

I've defined a query in my .hbm file:

Code:
<query name="org.pentaho.repository.content.findContentLocationByPath">
       <![CDATA[
       from org.pentaho.repository.content.ContentLocation cLoc where cLoc.dirPath = :inPath
       ]]>
</query>


The query definitely gets interpreted - here's the debugging output:

Code:
22:27:08,272 DEBUG QueryTranslatorImpl:207 - parse() - HQL:
       
       from org.pentaho.repository.content.ContentLocation cLoc where cLoc.dirPath = :inPath
       
     
22:27:08,302 DEBUG AST:223 - --- HQL AST ---
\-[QUERY] 'query'
    +-[SELECT_FROM] 'SELECT_FROM'
    |  \-[FROM] 'from'
    |     \-[RANGE] 'RANGE'
    |        +-[DOT] '.'
    |        |  +-[DOT] '.'
    |        |  |  +-[DOT] '.'
    |        |  |  |  +-[DOT] '.'
    |        |  |  |  |  +-[IDENT] 'org'
    |        |  |  |  |  \-[IDENT] 'pentaho'
    |        |  |  |  \-[IDENT] 'repository'
    |        |  |  \-[IDENT] 'content'
    |        |  \-[IDENT] 'ContentLocation'
    |        \-[ALIAS] 'cLoc'
    \-[WHERE] 'where'
       \-[EQ] '='
          +-[DOT] '.'
          |  +-[IDENT] 'cLoc'
          |  \-[IDENT] 'dirPath'
          \-[COLON] ':'
             \-[IDENT] 'inPath'
22:27:08,302 DEBUG ErrorCounter:68 - throwQueryException() : no errors
22:27:08,362 DEBUG HqlSqlBaseWalker:127 - query() << begin, level = 1
22:27:08,543 DEBUG FromElement:89 - FromClause{level=1} :  org.pentaho.repository.content.ContentLocation (cLoc) -> contentloc0_
22:27:08,543 DEBUG FromReferenceNode:48 - Resolved :  cLoc -> contentloc0_.CONTENTID
22:27:08,543 DEBUG DotNode:490 - getDataType() : dirPath -> org.hibernate.type.StringType@1ed1b0b
22:27:08,543 DEBUG FromReferenceNode:48 - Resolved :  cLoc.dirPath -> contentloc0_.DIRPATH
22:27:08,553 DEBUG HqlSqlBaseWalker:132 - query() : finishing up , level = 1
22:27:08,553 DEBUG HqlSqlWalker:362 - processQuery() :  ( SELECT ( FromClause{level=1} CONTENTLOCATION contentloc0_ ) ( where ( = ( contentloc0_.DIRPATH contentloc0_.CONTENTID dirPath ) ? ) ) )
22:27:08,563 DEBUG HqlSqlWalker:452 - Derived SELECT clause created.
22:27:08,593 DEBUG JoinProcessor:112 - Using FROM fragment [CONTENTLOCATION contentloc0_]
22:27:08,593 DEBUG HqlSqlBaseWalker:135 - query() >> end, level = 1


But, when I try to load the query using this code:

Code:
Session session = HibernateUtil.getSession();
Query qry = session.getNamedQuery("org.pentaho.repository.content.findContentLocationByPath");
qry.setString("inPath", thePath);
Object rtn = qry.uniqueResult();
return (ContentLocation)rtn;


I get this exception:

Code:
org.hibernate.MappingException: Named query not known: org.pentaho.repository.content.findContentLocationByPath
   at org.hibernate.impl.SessionImpl.getNamedQuery(SessionImpl.java:1027)
   at org.pentaho.repository.content.ContentRepository.getContentLocationByPath(ContentRepository.java:69)
   at com.pentaho.testharness.Testit.testCreateContentItem(Testit.java:635)
   at com.pentaho.testharness.Testit.main(Testit.java:76)
Exception in thread "main"


Anyone know what the problem is here?

Thanks,

Marc


Top
 Profile  
 
 Post subject: Figured it out
PostPosted: Tue Jul 05, 2005 10:54 pm 
Newbie

Joined: Tue Jun 28, 2005 4:26 pm
Posts: 5
It seems that there is some built-in name-spacing that I couldn't find in the documentation.


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

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.