Uploaded image for project: 'EJB 3.0'
  1. EJB 3.0
  2. EJBTHREE-210

Can't insert byte[] coumn into database

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • EJB 3.0 RC1
    • EJB 3.0 Beta 1
    • None
    • None

      I have a problem with Ingres database and byte[] mapping. I use byte[] without a @LOB annotation.

      public setMasterMac(byte[] masterMac)

      { this.masterMac = masterMac; }

      When I try to insert a value into the databese (the column is of type "long binary") I got error

      Caused by: java.lang.ClassCastException: [B
      at org.hibernate.type.ByteType.set(ByteType.java:38)
      at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:62)
      at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:39)

      The error message "... Ecxeption: [B" is strange. What means "[B". Why can't I insert a byte[] value into database? A pure JDBC test case with PreparedStatement.setBytes() works fine.

              rhn-engineering-ebernard Emmanuel Bernard
              lindner-1 Stefan Lindner (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: