Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
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.getNamedQuery(AbstractSessionImpl.java:70)
at org.hibernate.impl.SessionImpl.getNamedQuery(SessionImpl.java:1224)
at _jsp._clzone._reports._erp._namedquery__jsp._jspService(/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.doFilter(PageFilterChain.java:155)
at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:177)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:177)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:221)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:263)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:331)
at com.caucho.util.ThreadPool.runTasks(ThreadPool.java: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();
}
Thanx in advanced.....