• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate could not execute query

 
Pranav Gupta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I am not able find the answer.I have got the session and when i give createQuery,its printing the query ,but its not executing it.Please help me out.

And this the Query i am using

list = ss.createQuery("from "+Status.class.getName()).list();

Printed Query

Hibernate: select status0_.StatusCode as StatusCode2_, status0_.StatusName as St
atusName2_ from status status0_

This is my Hibernate.cfg.xml configuration

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="hibernate_SessionFactory">
<property name="connection.datasource">aaa</property>
<property name="show_sql">true</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.query.factory_class">rg.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://yash96-chiragr:3306/bugtracker</property>
<property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="transaction.manager_lookup_class">
org.hibernate.transaction.WeblogicTransactionManagerLookup
</property>
<mapping resource="Status.hbm.xml"/>
</session-factory>
</hibernate-configuration>


This is the error



org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificExceptio
n(ErrorCodeConverter.java:92)
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter
.java:80)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelp
er.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2150)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2026)
at org.hibernate.loader.Loader.list(Loader.java:2021)
at org.hibernate.hql.classic.QueryTranslatorImpl.list(QueryTranslatorImp
l.java:866)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:985)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at com.yash.BugTrackerAdmin.broker.AdminBroker1.dd(AdminBroker1.java:108
)
at com.yash.BugTrackerAdmin.manager.AdminManager.viewNewProject(AdminMan
ager.java:39)
at com.yash.BugTrackerAdmin.actionhandler.ProjectActionHandler.viewNewPr
oject(ProjectActionHandler.java:272)
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:324)
at com.yash.framework.portlet.YashPortlet.processAction(YashPortlet.java
:265)
at com.bea.portlet.container.PortletStub.processAction(PortletStub.java:
277)
at com.bea.portlet.container.AppContainer.invokeProcessAction(AppContain
er.java:428)
at com.bea.netuix.servlets.controls.content.JavaPortletContent.fireProce
ssAction(JavaPortletContent.java:202)
at com.bea.netuix.servlets.controls.portlet.JavaPortlet.fireProcessActio
n(JavaPortlet.java:1091)
at com.bea.netuix.servlets.controls.portlet.JavaPortlet.raiseChangeEvent
s(JavaPortlet.java:566)
at com.bea.netuix.nf.ControlLifecycle$4.postVisitRoot(ControlLifecycle.j
ava:298)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.j
ava:315)
at com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:127)
at com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:106)
at com.bea.netuix.nf.Lifecycle.runInbound(Lifecycle.java:173)
at com.bea.netuix.nf.Lifecycle.run(Lifecycle.java:137)
at com.bea.netuix.servlets.manager.UIServlet.runLifecycle(UIServlet.java
:321)
at com.bea.netuix.servlets.manager.UIServlet.doPost(UIServlet.java:184)
at com.bea.netuix.servlets.manager.PortalServlet.doPost(PortalServlet.ja
va:767)
at com.bea.netuix.servlets.manager.UIServlet.service(UIServlet.java:138)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:1006)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:419)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
va:27)
at com.bea.p13n.servlets.PortalServletFilter.doFilter(PortalServletFilte
r.java:293)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
va:27)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6724)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3764)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2644)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
Caused by: java.sql.SQLException: Invalid table name "STATUS" specified at posit
ion 85.
at com.pointbase.net.netJDBCPrimitives.handleResponse(Unknown Source)
at com.pointbase.net.netJDBCPrimitives.handleJDBCObjectResponse(Unknown
Source)
at com.pointbase.net.netJDBCConnection.prepareStatement(Unknown Source)
at weblogic.jdbc.common.internal.ConnectionEnv.makeStatement(ConnectionE
nv.java:1190)
at weblogic.jdbc.common.internal.ConnectionEnv.getCachedStatement(Connec
tionEnv.java:932)
at weblogic.jdbc.common.internal.ConnectionEnv.getCachedStatement(Connec
tionEnv.java:920)
at weblogic.jdbc.wrapper.Connection.prepareStatement(Connection.java:359
)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatch
er.java:431)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatch
er.java:366)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatc
her.java:105)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1561)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Lo
ader.java:223)
at org.hibernate.loader.Loader.doList(Loader.java:2147)
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a table called STATUS in your database? And does your status.hbm.xml mapping properly map to this? The exception message is reporting that this table does not exist.
 
Pranav Gupta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes i have the table,the same i am able to excute in tomcat
 
Pranav Gupta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The same query i was able to excute in Tomcat.I am getting the exception when i am trying to execute using the Weblogic
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Might be how you define your DataSource then. Does your DataSource user have select rights for that table? Is it connecting to the right database?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another question. I don't know pointbase at all so forgive me if this is a valid thing to do, but why are you using the MySQL dialect and a MySQL driver with pointbase?
 
Pranav Gupta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not using PointBase DataBase . I am using MySql. I have pointed by Application to MySql.PointBase is default.But we change the DataBase
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pranav Gupta:
I am not using PointBase DataBase . I am using MySql. I have pointed by Application to MySql.PointBase is default.But we change the DataBase


Not sure I follow. There are SQLExceptions in your stacktrace from the class com.pointbase.net.netJDBCPrimitives which is part of the pointbase driver, and are not included in any MySQL driver I've ever come accross. Are you sure you are using MySQL? You don't have another DataSource deployed on WebLogic with the same name or anything?
[ September 08, 2005: Message edited by: Paul Sturrock ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic