File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Problem regarding running NamedQuery() with Resin ??? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "Problem regarding running NamedQuery() with Resin ???" Watch "Problem regarding running NamedQuery() with Resin ???" New topic
Author

Problem regarding running NamedQuery() with Resin ???

Abhishek Bhar
Greenhorn

Joined: Aug 17, 2007
Posts: 1
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 racle 10g

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

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();
}
As you have seen above, I encountered this error,but surprisingly the above code works well with jdk1.5 and Tomcat.But when I work with jdk1.4 and Resin, then the above mensioned mapping exception occurs.
So can anyone tell,what is actually the problem as I hav to work with Resin. So what would be the solution. Is this a problem with the version or some configuration settings needed to be done.Please provide some solution as I am not able to call the stored procedures.
Regards,
Abhishek
 
 
subject: Problem regarding running NamedQuery() with Resin ???
 
Threads others viewed
bidirectional one to many mapping issues
SQL-Query not returning specified Object
Hibernate Issue
problem in parsing mapping document.
Hibernate inserting man-to-one fails
MyEclipse, The Clear Choice