Hello,
I am using Castle ActiveRecord for .NET version 2.1. for access to an Oracle Express 2008 database. I have a table with a BLOB column mapped like this.
[ActiveRecord("DOCUMENTS", Lazy=true)]
public class DOCUMENTS : ActiveRecordBase<DOCUMENTS>
{
private long id_document;
[PrimaryKey(SequenceName = "seq_DOCUMENTS")]
public virtual long Id_document
{
get { return id_document; }
set { id_document = value; }
}
private PRODUCTS product;
[BelongsTo("id_product")]
public virtual PRODUCTS Product
{
get { return product; }
set { product = value; }
}
private string name;
[Property]
public virtual string Name
{
get { return name; }
set { name = value; }
}
private string description;
[Property]
public virtual string Description
{
get { return description; }
set { description = value; }
}
[Property("content", ColumnType = "BinaryBlob" )]
public virtual byte[] Content { get; set; }
}
I have the following query
PRODUCTS[] ln = null;
using (new SessionScope())
{
DetachedCriteria criteria = DetachedCriteria.For<PRODUCTS>();
criteria.CreateAlias("ProdPunctDeLucru", "ppdl", JoinType.InnerJoin);
criteria.CreateAlias("Documents", "d", JoinType.InnerJoin);
criteria.Add(Restrictions.Or(Restrictions.IsNull("Status"),Restrictions.Not(Restrictions.Eq("Status", (byte)0))));
criteria.Add(Restrictions.Eq("Category.Id_name", (long)id_category));
criteria.Add(Restrictions.Eq("ppdl.Pct_de_lucru.Id_name", common.Singles.CurrentIdPctDeLucru));
criteria.Add(Restrictions.Gt("ppdl.Pret_cu_tva", (double)0));
ln = PRODUCTS.FindAll(criteria, Order.Asc("Name"));
}
This query should get a list of products and for each product one or no image BLOB. When getting only one product with one image the query works fine. If the list has more than one image i get the error
Invalid destination buffer (size of 0) offset: 0
Parameter name: bufferoffset
If i get the query with the Nhibernate Profiler it works fine in the Oracle query editor so the problem is with NHibernate or ActiveRecord
The stack trace is
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet`1 querySpaces, IType[] resultTypes)
at NHibernate.Loader.Criteria.CriteriaLoader.List(ISessionImplementor session)
at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results)
at NHibernate.Impl.CriteriaImpl.List(IList results)
at NHibernate.Impl.CriteriaImpl.List()
at Castle.ActiveRecord.ActiveRecordBase.FindAll(Type targetType, DetachedCriteria detachedCriteria, Order[] orders)
Anyone got an idea?
Thanks.