NHibernate
  1. NHibernate
  2. NH-2764

Binary data being truncated to 8000 bytes when persisting to varbinary(MAX) - Sql Server 2008

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Not an Issue
    • Affects Version/s: 3.1.0
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None

      Description

      Hi

      After upgrading from NHibernate 2.1 to 3.1.0 I appear to have hit a regression that was marked as fixed in version 3.1.0, refer NH-2484.

      All attempts to persist binary data exceeding 8k to varbinary(MAX) results in the data being truncated, all worked well using version 2.1, unfortunately upgrading to 3.1.0 has introduced this truncation issue.

      No exception is thrown and no indication is given that the attempt to serialize the binary data to varbinary(MAX) table column has occured.

      Attachment provided illustrates the issue.

        Issue Links

          Activity

          Hide
          Julian Maughan added a comment -

          The fluent mapping in your repro doesn't provide any type information to tell NH that you are mapping a Blob. I believe a 'byte[]' type is interpreted as a BinaryType which has a default max length of 8000. Try setting an explicit type of BinaryBlobType and/or setting the length to a value larger than 8000 bytes.

          Note that NH-2484 addresses a slightly different problem, where the type was defined (a serializable type), but the specified length was ignored.

          Show
          Julian Maughan added a comment - The fluent mapping in your repro doesn't provide any type information to tell NH that you are mapping a Blob. I believe a 'byte[]' type is interpreted as a BinaryType which has a default max length of 8000. Try setting an explicit type of BinaryBlobType and/or setting the length to a value larger than 8000 bytes. Note that NH-2484 addresses a slightly different problem, where the type was defined (a serializable type), but the specified length was ignored.

            People

            • Assignee:
              Unassigned
              Reporter:
              Brendan Cox
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Who's Looking?