0 Replies Latest reply: Nov 30, 2011 6:01 PM by user10016560 RSS

    StreamCorruptedException: invalid stream header using database-specific-sql

    user10016560
      We have a finder method defined using the <database-specific-sql> element in weblogic-cmp-rdbms-jar.xml. It works fine until we include a datetime column in the result. When we add the datetime column, we get the following exception:

      javax.ejb.FinderException: Exception executing finder findPromotionForPromoCode :
      java.io.StreamCorruptedException: invalid stream header: 959F0000
      java.io.StreamCorruptedException: invalid stream header: 959F0000
      at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:782)

      This is the sql we're using:

      <database-specific-sql>
      <database-type>SQLServer</database-type>
      <sql>SELECT sp.SalesPromotionID,
      sp.EffectiveFromDateTime,
      sp.DisplayText,
      sp.ReceiptText,
      sp.ValSalesPromotionTypeID,
      sp.AvailableForAllSalesChannelsFlag,
      sp.AvailableForAllClubsFlag,
      sp.AvailableForAllCustomersFlag,
      sp.PromotionCodeRequiredFlag,
      sp.PromotionCodeUsageLimit,
      sp.PromotionOwnerEmployeeID,
      sp.PromotionCodeIssuerCreateLimit,
      sp.PromotionCodeOverallCreateLimit
      FROM vSalesPromotion sp
      JOIN vSalesPromotionCode spc
      ON sp.salesPromotionID = spc.salesPromotionID
      WHERE spc.promotionCode = CONVERT( VARCHAR(51), ?1 )
      </sql>
      </database-specific-sql>

      The object type for EffectiveFromDate is Timestamp in the entity bean. The Sql Server data type is datetime. We're using WL 10.3.4.

      Has anyone used database specific sql for the finder method definition and successfully retrieved a datetime column?