I have a problem when insert an entity with composite-id
mapping file
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="WorkRequest.Data.Entity" assembly="WorkRequest.Data.Entity">
<class name="PartOrder" table="tblWRPartsOrdering">
<composite-id class="PartOrderPK" name="PartOrderPK">
<key-property name="WorkRequestNumber"/>
<key-property name="PartNumber"/>
</composite-id>
<property name="PartDescription" column="PartDesc" />
<property name="UnitCost" />
<property name="Quantity" column="Qty"/>
<property name="DateReceived" />
<many-to-one name="OrderedBy" class="WorkRequest.Data.Entity.User">
<column name="OrderedBy"></column>
</many-to-one>
<many-to-one name="WorkRequest" class="WorkRequest.Data.Entity.WR">
<column name="WorkRequestNumber"></column>
</many-to-one>
</class>
</hibernate-mapping>
code to save entity
Code:
PartOrder order = new PartOrder();
PartOrderPK pk = new PartOrderPK();
pk.PartNumber = "sss";
pk.WorkRequestNumber = 62912;
order.PartOrderPK = pk;
order.DateReceived = DateTime.Now;
//order.PartNumber = "sss";
//order.WorkRequestNumber = 62912;
session.Save(order);
when I debug. I see that nhibernate not procedure any insert query. I have show sql = true, but the console only show the query when I insert an entity with no composite id. no thing with this entity.
thanks in advanced