[hibernate-issues] [Hibernate-JIRA] Created: (HHH-4051) Issue with count(class) when class has a composite (@Embeddable) id

kareem shabazz (JIRA) noreply at atlassian.com
Tue Jul 21 16:06:12 EDT 2009


Issue with count(class) when class has a composite (@Embeddable) id
-------------------------------------------------------------------

                 Key: HHH-4051
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4051
             Project: Hibernate Core
          Issue Type: Bug
          Components: query-hql
    Affects Versions: 3.2.6
         Environment: Hibernate 3.2.6 on Oracle 10g
            Reporter: kareem shabazz
            Priority: Minor


When performing this query [(Long)session.createQuery("select count(c) from " + clazz.getSimpleName() + " c").uniqueResult()], the following error occurs

15:34:52.954 [main] DEBUG org.hibernate.SQL - 
    select
        count((contingenc0_.client_id,
        contingenc0_.dataset_id,
        contingenc0_.jurisdiction_id,
        contingenc0_.unit_id)) as col_0_0_ 
    from
        ctg_rates contingenc0_
Hibernate: 
    select
        count((contingenc0_.client_id,
        contingenc0_.dataset_id,
        contingenc0_.jurisdiction_id,
        contingenc0_.unit_id)) as col_0_0_ 
    from
        ctg_rates contingenc0_
15:34:52.985 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
15:34:52.985 [main] DEBUG o.h.util.JDBCExceptionReporter - could not execute query [select count((contingenc0_.client_id, contingenc0_.dataset_id, contingenc0_.jurisdiction_id, contingenc0_.unit_id)) as col_0_0_ from ctg_rates contingenc0_]
java.sql.SQLException: ORA-00907: missing right parenthesis

        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
        ...

The 4 properties (clientId, datasetId, unitid, jurisdictionId) make up an class annotated with @Embeddable and is used as the @Id in class ContingencyRate. The query looks fine, I can't imagine what could possibly be wrong other than a bug. ContingencyRate is persisted and retrived from the db without an issue in the same integration test suite.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list