facebook

org.hibernate.exception.GenericJDBCException

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #258522 Reply

    vamsi_tr
    Member

    Hi All ,

    I am getting
    org.hibernate.exception.GenericJDBCException: could not execute query

    problem while working with hibernate mysql.

    The Error is as follows :

    type Exception report

    message

    description The server encountered an internal error () that prevented it from fulfilling this request.

    exception

    org.apache.jasper.JasperException: Exception in JSP: /test.jsp:35

    32: Session sess1=UserSF.currentSession();
    33: String hql=”from Securityquestions order by securityquestionid”;
    34: Query qry=sess1.createQuery(hql);
    35: Iterator ite =qry.list().iterator();
    36: while(ite.hasNext())
    37: {
    38: Securityquestions sq=(Securityquestions)ite.next();

    Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

    root cause

    org.hibernate.exception.GenericJDBCException: could not execute query
    org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)
    org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80)
    org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
    org.hibernate.loader.Loader.doList(Loader.java:1596)
    org.hibernate.loader.Loader.list(Loader.java:1577)
    org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
    org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
    org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
    org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
    org.apache.jsp.test_jsp._jspService(test_jsp.java:85)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.

    ——————————————————————————–

    Apache Tomcat/5.5.17
    ——————————————————————————————————

    the actual code of test.jsp is:
    ———————————

    <%@ page language=”java” import=”java.util.*” pageEncoding=”UTF-8″%>
    <%@ page language=”java” import=”org.xplore.*” %>
    <%@ page language=”java” import=”org.hibernate.*” %>
    <%@ page language=”java” import=”org.hibernate.cfg.*” %>
    <%@ page language=”java” import=”java.lang.Object.*”%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+”://”+request.getServerName()+”:”+request.getServerPort()+path+”/”;
    %>

    <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
    <html>
    <head>
    <base href=”<%=basePath%>”>

    <title>My JSP ‘test.jsp’ starting page</title>

    <meta http-equiv=”pragma” content=”no-cache”>
    <meta http-equiv=”cache-control” content=”no-cache”>
    <meta http-equiv=”expires” content=”0″>
    <meta http-equiv=”keywords” content=”keyword1,keyword2,keyword3″>
    <meta http-equiv=”description” content=”This is my page”>

    <!–
    <link rel=”stylesheet” type=”text/css” href=”styles.css”>
    –>
    </head>
    <%
    String question=””;
    Integer id;
    Session sess1=UserSF.currentSession();
    String hql=”from Securityquestions order by securityquestionid”;
    Query qry=sess1.createQuery(hql);
    Iterator ite =qry.list().iterator();
    while(ite.hasNext())
    {
    Securityquestions sq=(Securityquestions)ite.next();
    question=sq.getQuestion();
    id=sq.getSecurityquestionid();

    out.print(id.intValue());
    out.println(“: “+question);
    }

    sess1.close();
    UserSF.closeSession();

    %>
    <body>

    </body>
    </html>

    ——————————————————————

    please help me

    Thanks in advance..

    Vamsi

    #258555 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev

    your query should be HQL, like “select questions from Securityquestions as questions order by questions.securityquestionid”

    or something like that.

    #258591 Reply

    vamsi_tr
    Member

    hi thanks for the quick reply

    I made the changed that you have suggested..

    But it is giving null pointer exception…

    Error is as follows

    ————————————————————–
    exception

    org.apache.jasper.JasperException: Exception in JSP: /test.jsp:34

    31: Integer id;
    32: Session sess1=UserSF.currentSession();
    33: String hql=”Select questions from Securityquestions as questions order by questions.securityquestionid”;
    34: Query qry=sess1.createQuery(hql);
    35: for(Iterator it=qry.iterate();it.hasNext();){
    36: Securityquestions sq=(Securityquestions)it.next();
    37: question=sq.getQuestion();

    Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

    root cause

    java.lang.NullPointerException
    org.apache.jsp.test_jsp._jspService(test_jsp.java:84)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

    please help me

    Thanks

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: org.hibernate.exception.GenericJDBCException

You must be logged in to post in the forum log in