12 Replies Latest reply on Mar 14, 2005 11:13 AM by Jan Radl

    Generated SQL Sentence too big

    Pablo Javier Santa Cruz Cosp Newbie

      I am using:

      jboss 3.2.7
      java 5 (sun's jsdk-1.5.01)
      Sybase ASE Express 12.5 (for Linux)
      Fedora Core 2 (RedHat)

      I have to E-EJBs (Order and OrderDetails). I have no problem with relations, but, when I created an order with many details (over 1000 details) and tried to retrieve it, I am having a problem with generated SQL.

      Generated SQL looks like this:

      2005-02-24 08:58:14,536 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.OrderLineItemEJB] Executing SQL: SELECT or
      derLineItemId, number FROM orders_details WHERE (orderLineItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?) OR (orderLin
      eItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?)
      OR (orderLineItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?) OR (orderLi
      neItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?)
       OR (orderLineItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?) OR (orderL
      ineItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?
      ) OR (orderLineItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?) OR (order
      LineItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?) OR (orderLineItemId=?) OR


      And it goes on, and on, and on.

      It is too big for SYBASE to process it.

      The exception I am getting is:

      2005-02-24 08:58:21,920 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackLocalException in method: public abstract py.com.roshka.wops4.document.orderLineItem.data.OrderLineItemEJBData py.com.roshka.wops4.document.orderLineItem.interfac
      es.OrderLineItemEJBLocal.getData(), causedBy:
      com.sybase.jdbc3.jdbc.SybSQLException: Message empty.


      Any ideas? Can I change the way that SQL is being generated? I think it is kind of inneficient. It might be better a simple join on Order's primary key.

      I read about lazy-load, eager-load, but I don't know if that would help me.

      Thanks a lot in advance!