I think you may want to set the length, since NH will automatically assign that, IIRC. Please create a test case for this if setting the length doesn't work.
On Thu, Sep 11, 2008 at 1:40 AM, Artur <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm very new to NHibernate, so I might be hitting a known problem, but > I searched for solution and couldn't find anything helpful. > > I want to use NHibernate (2.0 GA) together with SQL Server Compact > Edition (3.5 SP1). I need to store some images in the database so > adequate sql data type is Image and, as I understand, on NHibernate > side it should be mapped as BinaryBlob, and type of property in my > model should be byte[]. > > Initially, the relevant part of my mapping was: > > <property name="Data" type="BinaryBlob" not-null="true"/> > > but SchemaExport (from NHibernate.Tools.hbm2ddl) produced a > varbinary(4000) column from it. That was first sign that something is > wrong. > Later I changed the mapping and forced sql Image type with this: > <property name="Data" type="BinaryBlob"> > <column name="Data" sql-type="Image" not-null="true"/> > </property> > > That produced correct schema, but I can't persist anything large to > that column, because I get an exception saying: "byte > array truncation to a length of 8000". That looks like NHibernate is > setting wrong type for SQL query parameter. > > Am I doing something wrong or can it be some bug in NH? > > Kind regards > Artur > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
