0 Replies Latest reply on Nov 5, 2009 7:49 AM by Thomas Höfer

    How to avoid distinct in select cause when retrieving entity

    Thomas Höfer Newbie

      Hello everybody,

      i hope this is the correct forum to describe my problem. I use JBoss 4.0.4 in combination with Oracle 10g.

      If i try to retrieve an entity having a field mapped to a BLOB via a CMR than i get an exception shown below. Does JBoss add a distinct to the select clause?
      Because i detected: If i execute the sql query 'select distinct * from entity' via my DB-Tool DB-Visualizer, then i get the same sql exception. However, the same query without distinct works fine.

      How can I avoid that JBoss add a distinct to the query? Can i adjust that feature via the Declared-SQL mechanism?

      Thank you.

      Kind Regards
      Thomas

      Here is my stack trace:

      2009-11-05 13:02:49,525 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackException in method: ... causedBy:
      org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=deffm433/536, BranchQual=, localId=536] status=STATUS_NO_TRANSACTION; - nested throwable: (javax.ejb.EJBException: Store failed)
      at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:372)
      at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:501)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:361)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
      at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
      at org.jboss.ejb.Container.invoke(Container.java:954)
      at sun.reflect.GeneratedMethodAccessor148.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.run(LocalInvoker.java:158)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:177)
      at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
      at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:206)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:192)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
      at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
      at $Proxy658.getRule(Unknown Source)
      at com.cc.framework.adapter.struts.ActionUtil.execute(ActionUtil.java:643)
      at com.cc.framework.adapter.struts.FWAction.execute(FWAction.java:268)
      at com.cc.framework.adapter.struts.FWAction.execute(FWAction.java:298)
      at com.cc.framework.adapter.struts.RequestProcessorUtil.processAction(RequestProcessorUtil.java:78)
      at com.cc.framework.adapter.struts.FWRequestProcessor.processActionPerform(FWRequestProcessor.java:90)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
      at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at sun.reflect.GeneratedMethodAccessor159.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
      at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
      at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:245)
      at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50)
      at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
      at sun.reflect.GeneratedMethodAccessor172.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
      at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
      at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:217)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:197)
      at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50)
      at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at sun.reflect.GeneratedMethodAccessor171.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
      at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
      at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:217)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:197)
      at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50)
      at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      at java.lang.Thread.run(Thread.java:534)
      Caused by: javax.ejb.EJBException: Store failed
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.execute(JDBCStoreEntityCommand.java:158)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.storeEntity(JDBCStoreManager.java:666)
      at org.jboss.ejb.plugins.CMPPersistenceManager.storeEntity(CMPPersistenceManager.java:428)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.storeEntity(CachedConnectionInterceptor.java:273)
      at org.jboss.ejb.EntityContainer.storeEntity(EntityContainer.java:749)
      at org.jboss.ejb.GlobalTxEntityMap$2.synchronize(GlobalTxEntityMap.java:149)
      at org.jboss.ejb.GlobalTxEntityMap$GlobalTxSynchronization.synchronize(GlobalTxEntityMap.java:295)
      at org.jboss.ejb.GlobalTxEntityMap$GlobalTxSynchronization.beforeCompletion(GlobalTxEntityMap.java:345)
      at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1491)
      at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1110)
      at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:324)
      ... 104 more
      Caused by: java.sql.SQLException: ORA-00932: inconsistent datatypes: expected - got BLOB
      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
      at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
      at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:582)
      at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1986)
      at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1144)
      at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2152)
      at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:2035)
      at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2876)
      at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:609)
      at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:251)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.execute(JDBCStoreEntityCommand.java:150)
      ... 114 more