Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-14-2007, 01:59 PM
Member
 
Join Date: Aug 2007
Posts: 2
abhibh_1 is on a distinguished road
MappingException: Named query not known :
Hibernate version:3

<hibernate-mapping package="com.cl.pojo">
<class name="Address" table="ADDRESS">
<id name="id" type="long" column="ID" >
<generator class="increment"/>
</id>

<property name="std_id">
<column name="STD_ID" />
</property>
<property name="city">
<column name="CITY"/>
</property>
<property name="phone">
<column name="PHONE"/>
</property>


</class>
<query name="GetAllAddress">
<![CDATA[from com.cl.pojo.Address]]>
</query>

</hibernate-mapping>:

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

org.hibernate.MappingException: Named query not known: GetAllAddress
at org.hibernate.impl.AbstractSessionImpl.getNamedQue ry(AbstractSessionImpl.java:70)
at org.hibernate.impl.SessionImpl.getNamedQuery(Sessi onImpl.java:1224)
at _jsp._clzone._reports._erp._namedquery__jsp._jspSe rvice(/clzone/reports/erp/NamedQuery.jsp:32)
at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
at com.caucho.jsp.Page.pageservice(Page.java:571)
at com.caucho.server.dispatch.PageFilterChain.doFilte r(PageFilterChain.java:155)
at com.caucho.server.cache.CacheFilterChain.doFilter( CacheFilterChain.java:177)
at com.caucho.server.webapp.WebAppFilterChain.doFilte r(WebAppFilterChain.java:177)
at com.caucho.server.dispatch.ServletInvocation.servi ce(ServletInvocation.java:221)
at com.caucho.server.http.HttpRequest.handleRequest(H ttpRequest.java:263)
at com.caucho.server.port.TcpConnection.run(TcpConnec tion.java:331)
at com.caucho.util.ThreadPool.runTasks(ThreadPool.jav a:464)
at com.caucho.util.ThreadPool.run(ThreadPool.java:408 )
at java.lang.Thread.run(Thread.java:534)

:

Name and version of the database you are using:Oracle 10g

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


As u have seen the query named "GetAllAddress" is not been recognised.I tried use it within the class tag and outside it ...but could't able to run it.

So plz help me ... becoz for now i got stuck...
I used Query as ---
List addr = session2.getNamedQuery("GetAllAddress").list();
for(Iterator itr=addr.iterator();itr.hasNext()
{
Address a = (Address)itr.next();
long ID = a.getId();
int FirstName = a.getStd_id();
String Phone = a.getPhone();
String City = a.getCity();
}
I have tried everything, but not able to run it.
In the mapping file I have written
<query name="allAddress">
<![CDATA[from com.cl.pojo.Address]]>
</query>
also tried
<![CDATA[ From Address ]]>
And in the jsp I have written:
List addr = session2.getNamedQuery("allAddress").list(); and
List addr = session2.getNamedQuery("com.cl.pojo.Address.allAdd ress").list();

But nothing seemed to work properly
Waiting for ur useful suggestions...

Regards
Abhishek
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help in Query geeta_ravikanti Database 0 03-31-2008 02:16 PM
Hibernate sql query taicode Database 0 03-25-2008 05:17 PM
Using sql:query tag Java Tip Java Tips 0 01-15-2008 04:13 PM
Using sql:query tag Java Tip Java Tips 0 01-14-2008 10:31 AM
named pipes samson Networking 1 04-04-2007 07:40 AM


All times are GMT +3. The time now is 12:51 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org