facebook

hibernate GenericJDBCException: could not exec

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

    blaplante
    Member

    I searched a bit and only found one thread on this subject but not follow up.

    Basic problem:
    ——————
    I can not execute a hql query in a hibernate project. I inherited this web application and it is working today. As I am going to be changing the application I want to use the hql query tool to see that the queries continue to run as I change them. When I try to run one of the queries that work from within the application I get the stack trace below. Any hints would be appreciated as to how I can solve this problem.

    Configuration info:
    ———————
    WinXP SP2
    Version: 5.0.1 GA
    Build id: 20060810-5.0.1-GA
    Hibernate3.0 + Spring

    Hibernate config info.
    —————————

    
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-configuration PUBLIC
            "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
            "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
    <hibernate-configuration>
        <session-factory>
        <property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
        <property name="hibernate.connection.url">jdbc:postgresql://localhost/???</property>
        <property name="hibernate.connection.username">???</property>
        <property name="hibernate.connection.password">???</property>
        <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
    
        <!-- can not show path to hbm.xml's -->
        <!-- the application runs all hql queries successfully -->
        </session-factory>
    </hibernate-configuration>
    

    Stack trace from PDE Error log.
    ————————————-
    Error
    Thu Mar 15 14:11:46 EDT 2007
    org.hibernate.exception.GenericJDBCException: could not execute query

    org.hibernate.exception.GenericJDBCException: could not execute query
    at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
    at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
    at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
    at org.hibernate.loader.Loader.doList(Loader.java:2148)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
    at org.hibernate.loader.Loader.list(Loader.java:2024)
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
    at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308)
    at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)
    at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1129)
    at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
    at org.hibernate.console.HQLQueryPage.getList(HQLQueryPage.java:33)
    at org.hibernate.console.ConsoleConfiguration$3.execute(ConsoleConfiguration.java:300)
    at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
    at org.hibernate.console.ConsoleConfiguration.executeHQLQuery(ConsoleConfiguration.java:289)
    at com.genuitec.eclipse.hibernate.action.MEExecuteHQLAction$ExecuteHQLJob.run(MEExecuteHQLAction.java:76)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
    Caused by: java.sql.SQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1471)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1256)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:388)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:329)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:239)
    at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
    at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
    at org.hibernate.loader.Loader.doQuery(Loader.java:662)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
    at org.hibernate.loader.Loader.doList(Loader.java:2145)
    … 13 more

    #267460 Reply

    Riyad Kalla
    Member

    Try and scroll down to the bottom of the stack trace to see what caused the issue.

    Also you want to make sure that:
    1) You don’t have Hibernate Tools installed
    2) You have added Hibernate and Spring capabilities to your project so MyEclipse understands it

    #267470 Reply

    blaplante
    Member

    When you right click on the Exception in the PDE Error view what I pasted to the previous message is all you get.

    I added the spring capability and still no go. Is there any xml I can look at such as a nature or feature specific config to verify that all requirements are met per the two capabilities?

    #267478 Reply

    Riyad Kalla
    Member

    You can open your project properties and go to the MyEclipse node, the icons for each technology should be “lit up”. You want to make sure Hibernate and Spring are lit up.

    #267484 Reply

    blaplante
    Member

    correct, I have web, Hibernate and Spring all lit up. I also tried to copy the query translator results into a sql query winodw and pgAdminIII complains about

    
    ERROR:  invalid reference to FROM-clause entry for table "operations1_"
    HINT:  There is an entry for table "operations1_", but it cannot be referenced from this part of the query.
    

    Here is the query that it writes.

    
    select
      customer4_.number as col_0_0_,
      serviceord0_.number as col_1_0_,
      operations1_.number as col_2_0_,
      operations1_.card_number as col_3_0_,
      operations1_.wbc_id as col_4_0_,
      approval6_.status as col_5_0_,
      approval6_.time as col_6_0_,
      user9_.username as col_7_0_,
      customerno3_.runTime as col_8_0_,
      user10_.username as col_9_0_,
      customerno3_.text as col_10_0_,
      workbreakd5_.id as id46_,
      workbreakd5_.code as code46_ 
     from
      service_orders serviceord0_ 
     inner join
      operations operations1_ 
       on serviceord0_.id=operations1_.service_order_id 
     inner join
      settlement_sheets settlement2_ 
       on operations1_.settlement_sheet_id=settlement2_.id 
     left outer join
      customer_notes customerno3_ 
       on settlement2_.id=customerno3_.labor_settlement_id,
      users user10_,
      approvals approval6_,
      users user9_ 
     inner join
      wbcs workbreakd5_ 
       on operations1_.wbc_id=workbreakd5_.id,
      customers customer4_ 
     where
      serviceord0_.customer_id=customer4_.id 
      and approval6_.user_id=user9_.id 
      and settlement2_.approval_id=approval6_.id 
      and customerno3_.user_id=user10_.id 
      and approval6_.status=? 
      and approval6_.submitted_status=? 
      and approval6_.time>=? 
      and customerno3_.id=(
       select
        max(customerno14_.id) 
       from
        customer_notes customerno14_ 
       where
        settlement2_.id=customerno14_.labor_settlement_id
      ) 
     order by
      customer4_.number,
      serviceord0_.number,
      operations1_.number,
      operations1_.card_number,
      operations1_.wbc_id,
      approval6_.status,
      approval6_.time,
      user9_.username,
      customerno3_.runTime,
      user10_.username,
      customerno3_.text
    
    #267498 Reply

    Haris Peco
    Member

    blaplante,

    Could you please send your hql query, hbm.xml files, ddl files (create table, foreign keys etc) and POJO files for this case.
    It looks like Hibernate bug (translation hql to sql), but I can’t be sure without concrete case.However, you can try with hibernate 3.1.

    Thanks,

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: hibernate GenericJDBCException: could not exec

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