3 Replies Latest reply on Jul 19, 2004 5:38 AM by Lloyd Davies

    How can I map a VARCHAR db column to a byte[] using CMP?

    Lloyd Davies Newbie

      Hi,

      I have some code that looks like this:

      /**
      * @ejb.persistence
      * column-name="card_number"
      */
      public abstract byte[] getCardNumber();

      It doesn't work. If I change the byte[] to a String it works fine, but as it is I get the following error:

      Caused by: javax.ejb.TransactionRolledbackLocalException: Internal error getting results for field member cardNumber; CausedByException is:
      Got a java.lang.String[cl=0, value=abcdefg] while looking for a [B[cl=4558657]; CausedByException is:
      Internal error getting results for field member cardNumber; CausedByException is:
      Got a java.lang.String[cl=0, value=abcdefg] while looking for a [B[cl=4558657]
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:204)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:315)
      ....

      With Jrun, I could just switch between byte[] and String no problem, but I can't with JBoss.

      Any suggestions?

      Thanks.