-->
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: net.sf.hibernate.MappingException: Named query not known:
PostPosted: Wed Dec 01, 2004 5:09 pm 
Newbie

Joined: Wed Dec 01, 2004 4:51 pm
Posts: 5
Details follow below. I have other named queries that work... I'm a bit suspicious this map isn't being loaded. All of my hibernate maps are in the WEB-INF/classes directory, and I've verified there is only one query with this name. Is there anyway to view all the loaded mapping information?

Any pointers would be appreciated. Thanks!

Hibernate version: Hibernate 2.1.6

Mapping documents:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class name="com.robico.billing.asterisk.data.AsteriskResourceBO" table="user_phone">
<id name="id" type="int" unsaved-value="0" >
<column name="up_id" sql-type="int" not-null="true"/>
<generator class="identity"/>
</id>
<property name="resourceName">
<column name="phone" sql-type="varchar(80)" not-null="true"/>
</property>
<many-to-one name="login" column="login" class="com.robico.data.billing.LoginBO" not-null="true" />
<property name="activeDate">
<column name="active_date" sql-type="date" not-null="false"/>
</property>
<property name="expiresDate">
<column name="expires_date" sql-type="date" not-null="false"/>
</property>
</class>
<query name="com.robico.billing.asterisk.data.loadPhones">
from com.robico.billing.asterisk.data.AsteriskResourceBO as arb
</query>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():

try {
query = session.getNamedQuery( "com.robico.billing.asterisk.data.loadPhones" );
results = query.list();
} catch ( HibernateException e ) {
e.printStackTrace();
}


Full stack trace of any exception that occurs:
net.sf.hibernate.MappingException: Named query not known: com.robico.billing.asterisk.data.loadPhones
at net.sf.hibernate.impl.SessionImpl.getNamedQuery(SessionImpl.java:1765)
at com.robico.billing.asterisk.AsteriskPhoneTable.loadPhoneTable(AsteriskPhoneTable.java:86)
at com.robico.billing.asterisk.AsteriskPhoneTable.init(AsteriskPhoneTable.java:110)
at com.robico.billing.asterisk.AsteriskPhoneTable.<init>(AsteriskPhoneTable.java:41)
at com.robico.billing.asterisk.AsteriskChargeManager.init(AsteriskChargeManager.java:109)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:839)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:332)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1029)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4013)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
at org.apache.catalina.core.StandardHostDeployer.addChild(StandardHostDeployer.java:903)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216)
at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:256)
at org.apache.commons.digester.Rule.end(Rule.java:276)
at org.apache.commons.digester.Digester.endElement(Digester.java:1058)
at org.apache.catalina.util.CatalinaDigester.endElement(CatalinaDigester.java:76)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1567)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:488)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:863)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:483)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
at org.apache.catalina.core.StandardService.start(StandardService.java:480)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)

Name and version of the database you are using:

MySQL 4.0.18


Top
 Profile  
 
 Post subject: Resolved
PostPosted: Wed Dec 01, 2004 5:39 pm 
Newbie

Joined: Wed Dec 01, 2004 4:51 pm
Posts: 5
/sigh

Sorry about the post. Turned everything in log4j to debug and discovered I forgot to add the new <mapping resources> in hibernate.cfg.xml

On to the next problems.


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.