First I would like to know why you are using "prepare_sql"...for this ?
http://nhforge.org/wikis/howtonh/tuning-queries-with-ms-sqlserver.aspx

then I would like to understand why you are using SerializabeType to store
an image (especially when you have BinaryBlob)

2009/5/19 Graham Bunce <[email protected]>

>
> All,
>
> I'm using 1.2GA (and am not able to upgrade, tried and loads of lazy
> load issues). I'm using SQL Server 2005 an am saving a Bitmap into a
> varbinary(max) column.
>
> To do this I'm using a Serializable NH mapping.
>
> This works fine until I add "prepare_sql" to the NH config file. After
> this, this HQL statement "FROM Advert" that generates this SQL (from
> the SQL profiler)
>
> "SQL:BatchCompleted, select advert0_.Id as Id29_, advert0_.FileName as
> FileName29_, advert0_.NavigateUrl as Navigate3_29_, advert0_.ImageData
> as ImageData29_, advert0_.AlternateText as Alternat5_29_,
> advert0_.IsNew as IsNew29_ from Administration.Advert advert0_"
>
> fails with a C# "Could not deserialize a serializable property:" in
> NH. Stack Trace:
>
>   at NHibernate.Type.SerializableType.FromBytes(Byte[] bytes)
>   at NHibernate.Type.SerializableType.Get(IDataReader rs, Int32
> index)
>   at NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String
> name)
>   at NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String
> [] names, ISessionImplementor session, Object owner)
>   at NHibernate.Type.AbstractType.Hydrate(IDataReader rs, String[]
> names, ISessionImplementor session, Object owner)
>   at NHibernate.Loader.Loader.Hydrate(IDataReader rs, Object id,
> Object obj, ILoadable persister, ISessionImplementor session, String[]
> [] suffixedPropertyColumns)
>   at NHibernate.Loader.Loader.LoadFromResultSet(IDataReader rs, Int32
> i, Object obj, Type instanceClass, EntityKey key, LockMode lockMode,
> ILoadable rootPersister, ISessionImplementor session)
>   at NHibernate.Loader.Loader.InstanceNotYetLoaded(IDataReader dr,
> Int32 i, ILoadable persister, EntityKey key, LockMode lockMode,
> EntityKey optionalObjectKey, Object optionalObject, IList
> hydratedObjects, ISessionImplementor session)
>   at NHibernate.Loader.Loader.GetRow(IDataReader rs, ILoadable[]
> persisters, EntityKey[] keys, Object optionalObject, EntityKey
> optionalObjectKey, LockMode[] lockModes, IList hydratedObjects,
> ISessionImplementor session)
>   at NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader
> resultSet, ISessionImplementor session, QueryParameters
> queryParameters, LockMode[] lockModeArray, EntityKey
> optionalObjectKey, IList hydratedObjects, EntityKey[] keys, Boolean
> returnProxies)
>   at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session,
> QueryParameters queryParameters, Boolean returnProxies)
>
> Obviously its to do with the "prepare_sql" but I really don't want to
> remove this. I've tried writing to a byte[] array and use a NH binary
> mapping but this doesn't seem to pull the data back from SQL correctly
> to enable me to convert the byte array back to a bitmap.
>
> Any ideas for a workaround that works for 1.2GA ?
> >
>


-- 
Fabio Maulo

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to