Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-175

mod() function not supported in SQL server 2005

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 4.2.RC6
    • 4.2.RC5
    • System
    • None
    • MS SQL Server 2005

      Looks like the mod() function has been replaced by the % (Modulo) (SSIS) operator in MS SQL Server 2005.

      Hence the generated sql throws an error when it used the mod() function with SQL Server 2005

      com/sun/ts/tests/ejb/ee/pm/ejbql/where_clause/Client.java#whereTest41

      2007-05-15 11:20:26,062 DEBUG org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.ProductEJB#findProductsByQuery6 Executing SQL: SELECT DISTINCT t0_p.ID, t0_p.PNUM, t0_p.PRICE, t0_p.NAME, t0_p.QUANTITY FROM PRODUCTEJB_TABLE t0_p WHERE mod(550, 100) = t0_p.QUANTITY
      2007-05-15 11:20:26,171 ERROR org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.ProductEJB#findProductsByQuery6 Find failed
      com.microsoft.sqlserver.jdbc.SQLServerException: 'mod' is not a recognized built-in function name.
      at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
      at com.microsoft.sqlserver.jdbc.IOBuffer.processPackets(Unknown Source)
      at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.getPrepExecResponse(Unknown Source)
      at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
      at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PreparedStatementExecutionRequest.executeStatement(Unknown Source)
      at com.microsoft.sqlserver.jdbc.CancelableRequest.execute(Unknown Source)
      at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeRequest(Unknown Source)
      at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(Unknown Source)
      at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:236)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCAbstractQueryCommand.java:243)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCAbstractQueryCommand.java:144)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCFindEntitiesCommand.execute(JDBCFindEntitiesCommand.java:54)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.findEntities(JDBCStoreManager.java:613)
      at org.jboss.ejb.plugins.CMPPersistenceManager.findEntities(CMPPersistenceManager.java:337)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.findEntities(CachedConnectionInterceptor.java:242)
      at org.jboss.ejb.EntityContainer.find(EntityContainer.java:713)
      at sun.reflect.GeneratedMethodAccessor143.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1126)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:105)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:203)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:189)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:105)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:136)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:76)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:45)
      at org.jboss.ejb.plugins.CallValidationInterceptor.invokeHome(CallValidationInterceptor.java:56)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:125)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:161)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:145)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:132)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:107)
      at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:521)
      at org.jboss.ejb.Container.invoke(Container.java:981)

            rrajasek@redhat.com Rajesh Rajasekaran
            rrajasek@redhat.com Rajesh Rajasekaran
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: