Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: 3.2
    • Component/s: None
    • Labels:
      None
    • Environment:

      HIbernate/Spring cartridge

      Description

      Hi there,
      HibernateByteBlobType.nullSafeGet and nullSafeSet are not null save, NPE are thrown in both cases if the value is null.
      I would suggest something like that:

      public void nullSafeSet(PreparedStatement st, Object value, int index)
      throws SQLException
      {
      byte[] b = (byte[])value;
      if(b!= null )

      { st.setBinaryStream(index, new ByteArrayInputStream(b), b.length); }

      else

      { st.setBinaryStream(index,null,0); }

      }

      public Object nullSafeGet(ResultSet rs, String[] names, Object owner)
      throws SQLException
      {
      Blob blob = rs.getBlob(names0);
      if(blob == null)

      { return null; }

      else

      { return blob.getBytes(1, (int)blob.length()); }

      }

      Regards
      Darius

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                overheat Plushnikov Michail
                Reporter:
                darius.schier Darius Schier
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: