私は次のようなマッピングを持っています:
public class InvoiceDetailMapping : ClassMap<InvoiceDetail>
{
public InvoiceDetailMapping()
{
Id(x => x.DetailId)
.GeneratedBy.Guid();
Map(x => x.Account);
Map(x => x.Credit);
Map(x => x.Debit);
Map(x => x.PayType);
Map(x => x.RowNumber);
References<InvoiceItem>(x => x.Invoice, "InvoiceItemId")
.Cascade.All();
}
}
public class InvoiceItemMapping : ClassMap<InvoiceItem>
{
public InvoiceItemMapping()
{
Id(x => x.RecordId)
.GeneratedBy.Guid();
Map(x => x.BatchId);
Map(x => x.Description);
Map(x => x.DocumentDate);
Map(x => x.DocumentId);
Map(x => x.DocumentType);
Map(x => x.FileId);
Map(x => x.FileName);
Map(x => x.InvoiceAmount);
Map(x => x.LocationCode);
Map(x => x.PayDate);
Map(x => x.PaymentTerms);
Map(x => x.PayNumber);
Map(x => x.PurchaseAmount);
Map(x => x.PurchaseInvoiceAmount);
Map(x => x.InvoiceId);
Map(x => x.Submittable);
Map(x => x.SubmittedBy);
Map(x => x.SubmittedTimeStamp);
Map(x => x.TaxForm1099Amount);
Map(x => x.TroubleClass);
Map(x => x.VendorDocNumber);
Map(x => x.VendorId);
Map(x => x.PersistedTimeStamp)
.CustomType<UtcDateTimeType>()
.Generated.Insert();
HasMany<InvoiceDetail>(x => x.InvoiceDetails)
.Inverse()
.Cascade.All()
.KeyColumn("InvoiceItemId");
}
}
...しかし、これをPostgreSQLデータベースに適用すると、InvoiceDetailに対して次のSQLが作成されます。
CREATE TABLE "InvoiceDetail"
(
detailid uuid NOT NULL,
account character varying(255),
credit numeric(19,5),
debit numeric(19,5),
paytype integer,
rownumber integer,
invoiceitemid uuid,
CONSTRAINT "InvoiceDetail_pkey" PRIMARY KEY (detailid ),
CONSTRAINT fkd8588014e9009e93 FOREIGN KEY (invoiceitemid)
REFERENCES "InvoiceItem" (recordid) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
行に注意してくださいON UPDATE NO ACTION ON DELETE NO ACTION
。Cascade.All()
ディレクティブがON UPDATE CASCADE ON DELETE CASCADE
DDLを作成すると思っていたでしょう。私は間違ってまたは不完全に何をしましたか?