-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Oracle missing parenthesis problem
PostPosted: Fri Nov 02, 2007 12:34 pm 
Newbie

Joined: Fri Nov 02, 2007 12:19 pm
Posts: 1
I am using hibernate core 3.2.5, annotations 3.3.0, em 3.3.1 with glassfish and have run into what appears to be another missing right parenthesis bug. I am using an Oracle 8i DB and the latest JDBC drivers from Oracle.

I have a class with an embedded PK:
Code:
public class CompanyBookContent implements Serializable
{
    private boolean active;
    private BookDetail bookDetail;
    private Snapcapsule company;
    protected CompanyBookContentPK companyBookContentPK;
    private String content;
    private Boolean featured;
    private short orderBy;
    private CompanyBookContentType type;
}
public class CompanyBookContentPK implements Serializable
{
    private long bookId;
    private long companyId
}


I am trying to run a count on CompanyBookContent, using the EJBQL query:
Code:
SELECT COUNT(cbc) FROM CompanyBookContent cbc WHERE cbc.type=:type AND cbc.companyBookContentPK.companyId=:companyId.


which gets translated into SQL as:
Code:
select count((companyboo0_.BOOK_ID, companyboo0_.COMPANY_ID)) as col_0_0_ from COMPANY_BOOKCONTENT companyboo0_ where companyboo0_.TYPE=? and companyboo0_.COMPANY_ID=?


Oracle does not like the two IDs in the count parenthesis. I am pretty sure this is a bug, in what area of the JIRA should I post this. Stacktrace follows.


Jim McCollom
Code:

[#|2007-11-02T12:09:12.771-0400|INFO|sun-appserver-pe9.0|javax.enterprise.system.stream.out|_ThreadID=21;_ThreadName=p: thread-pool-1; w: 10;|
Hibernate: select count((companyboo0_.BOOK_ID, companyboo0_.COMPANY_ID)) as col_0_0_ from COMPANY_BOOKCONTENT companyboo0_ where companyboo0_.TYPE=? and companyboo0_.COMPANY_ID=?|#]

[#|2007-11-02T12:09:12.776-0400|WARNING|sun-appserver-pe9.0|javax.enterprise.system.stream.err|_ThreadID=21;_ThreadName=p: thread-pool-1; w: 10;_RequestID=d0e2fb56-886b-4b08-84d3-23b4eee8f435;|
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
        at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:630)
        at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:75)
        at com.vault.eao.BookContentEaoJpa.companyHasBookContent(BookContentEaoJpa.java:44)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1050)
        at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:165)
        at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2766)
        at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3847)
        at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:184)
        at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:71)
        at $Proxy105.companyHasBookContent(Unknown Source)
        at com.vault.manager.books.BookContentManagerBean.companyHasBookContent(BookContentManagerBean.java:21)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1050)
        at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:165)
        at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2766)
        at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3847)
        at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:190)
        at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:67)
        at $Proxy103.companyHasBookContent(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:121)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:650)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:193)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1705)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1565)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:947)
        at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:178)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:717)
        at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:473)
        at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1270)
        at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:479)
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
        at org.hibernate.loader.Loader.doList(Loader.java:2223)
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
        at org.hibernate.loader.Loader.list(Loader.java:2099)
        at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
        at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
        at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
        at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
        at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:66)
        ... 39 more
Caused by: java.sql.SQLException: ORA-00907: missing right parenthesis

        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
        at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
        at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
        at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
        at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:643)
        at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:1674)
        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1870)
        at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
        at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:314)
        at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
        at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
        at org.hibernate.loader.Loader.doQuery(Loader.java:674)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
        at org.hibernate.loader.Loader.doList(Loader.java:2220)
        ... 47 more
|#]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.