Update/Insert without select
Posted
by user348731
on Stack Overflow
See other posts from Stack Overflow
or by user348731
Published on 2010-05-26T06:26:46Z
Indexed on
2010/05/26
6:31 UTC
Read the original article
Hit count: 242
nhibernate
I have this very simple class
public class ProductAttributeValuePortal
{
public virtual int ID { get; set; }
public virtual Domain.Entity.Portals.ProductPortal Product { get; set; }
public virtual Attribute Attribute { get; set; }
public virtual string Value { get; set; }
}
with this very simple map
public ProductAttributeValueMap ()
{
Table("DM.dbo.ProductAttributeValues");
Id(x => x.ID, "ProductAttributeValue_id");
References(x => x.Product);
References(x => x.Attribute);
Map(x => x.Value);
}
Each time i make a insert NHibernate makes a Select of the attribute like :
NHibernate: INSERT INTO MachineData.dbo.ProductAttributeValues (Value, Product_id,
Attribute_id) VALUES (@p0, @p1, @p2); select SCOPE_IDENTITY();@p0 = '6745', @p1 = 39, @p2 = 'BSTD'
NHibernate: SELECT attribute_.Attribute_id, attribute_.Name as Name21_, attribute_.AttributeType as Attribut3_21_, attribute_.TagName as TagName21_, attribute_.MapTo as MapTo21_ FROM MachineShared.dbo.Attributes attribute_ WHERE attribute_.Attribute_id=@p0;@p0 = 'DLB'
What am i doing wrong. And where do i find some really uptodate books about nhibernate/Fluent nhibernate
© Stack Overflow or respective owner