A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Databases
»
Object Relational Mapping
Author
Named Query not found
Gaurav Chikara
Ranch Hand
Joined: Jun 09, 2000
Posts: 410
posted
Jan 10, 2007 18:38:00
0
Dear All
I am using the following mapping file in hibernate and on runtime I get the exception
com.good.common.exception.StoreException: com.good.common.exception.StoreExcepti on: net.sf.hibernate.MappingException: Named query not known: getAllAlerts at com.good.bl.glp.UserAlertsBL.getUserAlertsByDeploymentId(UserAlertsBL .java:90) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.good.dbaccess.common.Delegate.invoke(Delegate.java:296) at com.good.dbaccess.common.Delegate.invoke(Delegate.java:69) at com.good.itconsole.actions.glp.MailConfigureAction.myExecute(MailConf igureAction.java:44)
My mapping file is following
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"> <hibernate-mapping> <class name="com.good.bean.glp.UserAlerts" schema="LMDB" table="USER_ALERTS"> <property column="DEPLOYMENT_ID" length="15" name="deploymentId" not-null="true" type="java.lang.Long"/> <property column="TASK_ID" length="15" name="taskId" not-null="true" type="java.lang.Long"/> <property column="SUBJECT" length="128" name="subject" type="java.lang.String"/> <property column="BODY" length="4000" name="body" type="java.lang.String"/> <property column="ENABLED" length="15" name="enabled" type="java.lang.Long"/> <property column="CREATED_DATE" length="7" name="createdDate" type="java.util.Date"/> <property column="CREATED_BY" length="100" name="createdBy" type="java.lang.String"/> <property column="MODIFIED_DATE" length="7" name="modifiedDate" type="java.util.Date"/> <property column="MODIFIED_BY" length="100" name="modifiedBy" type="java.lang.String"/> </class> <query name="getAllAlerts"> select a.deploymentId,a.taskId,a.subject,a.body,a.enabled,a.createdDate,a.createdBy, a.modifiedDate,a.modifiedBy from com.good.bean.glp.UserAlerts a where a.deploymentId=? </query> </hibernate-mapping>
I am not sure what could be the reason for it.I have used named queries before and it used to work. Am I missing something?
SCJP,SCWCD,SCBCD<br />If Opportunity doesn't knock then build the door
Mark Spritzler
ranger
Sheriff
Joined: Feb 05, 2001
Posts: 17224
1
I like...
posted
Jan 11, 2007 00:06:00
0
What is your Java code to get the named query?
Mark
Perfect World Programming, LLC
-
Two Laptop Bag
-
Tube Organizer
How to Ask Questions the Smart Way FAQ
Gaurav Chikara
Ranch Hand
Joined: Jun 09, 2000
Posts: 410
posted
Jan 15, 2007 22:44:00
0
I was able to resolve this.Thanks a bunch for your offer to help
I agree. Here's the link:
http://aspose.com/file-tools
subject: Named Query not found
Similar Threads
Classcast exception
Calling HBM query in HBM file
Problem with Hibernate composite key mapping
updating records, for a table without primary key.
Join table with DetachedCriteria
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter