Dear All;
When i recreate a collection in Payment Entity saveOrUpdate method throwed
this exception. My Releation Mappings is AllDeleteOrphan but i dont resolve
this problem.
I am working on this error two days ago. I'm going crazy :'(
I tested this solution method.
1- Manual handle cascade operation.
a-Delete exists PartnerTransactions on before save
b-Save Payment entity
c- Save new PartnerTransactions
but throw object references an unsaved transient instance - save the
transient instance before merge.
What do you think about it.?
object references an unsaved transient instance - save the transient
instance before flushing or set cascade action for the property to
something that would make it autosave. Type:
Core.PartnerManagement.PartnerTransaction, Entity:
Core.PartnerManagement.PartnerTransaction
public class PaymentMap : ClassMap<Payment>
{
public PaymentMap()
{
Table("SALES_TB_PAYMENT");
SchemaAction.None();
Id(x => x.ID, "ID").GeneratedBy.Identity();
Map(x => x.PaymentDate, "PaymentDate");
Map(x => x.Serial, "Serial");
Map(x => x.DocumentNumber, "DocumentNumber");
References(x => x.Partner, "PartnerId");
References(x => x.Cash, "CashId");
References(x => x.Pos, "PosId");
References(x => x.DocumentType, "DocumentTypeId");
Map(x => x.Description, "Description");
Map(x => x.ExchangeRate, "ExchangeRate");
Map(x => x.AccountExchangeRate, "AccountExchangeRate");
Map(x => x.Amount, "Amount");
Map(x => x.AccountAmount, "AccountAmount");
Map(x => x.LocalAmount, "LocalAmount");
Map(x => x.BankSEQ, "BankSEQ");
References(x => x.Bank, "BankId");
Map(x => x.IBAN, "IBAN");
Map(x => x.AccountNo, "AccountNo");
Map(x => x.BankBranch, "BankBranch");
Map(x => x.ReferenceNo, "ReferenceNo");
Map(x => x.SlipNo, "SlipNo");
Map(x => x.RewardAmount, "RewardAmount");
Map(x => x.ComissionRate, "ComissionRate");
Map(x => x.ComissionAmount, "ComissionAmount");
Map(x => x.LocalComissionAmount, "LocalComissionAmount");
Map(x => x.Installment, "Installment");
References(x => x.Currency, "CurrencyId");
References(x => x.LocalCurrency, "LocalCurrencyId");
References(x => x.AccountCurrency, "AccountCurrencyId");
References(x => x.CreditCard, "CreditCardId");
HasMany(x => x.Transactions)
.KeyColumn("PaymentId")
.Cascade.AllDeleteOrphan()
.AsBag();
}
}
public class PartnerTransactionMap : ClassMap<PartnerTransaction>
{
public PartnerTransactionMap()
{
Table("CORE_TB_PARTNERTRANSACTION");
SchemaAction.None();
Id(x => x.ID, "ID").GeneratedBy.Identity().UnsavedValue(0L);
Map(x => x.TransactionDateTime, "TransactionDateTime");
References(x => x.Partner, "PartnerId");
References(x => x.Currency, "CurrencyId");
References(x => x.LocalCurrency, "LocalCurrencyId");
Map(x => x.ExchangeRate, "ExchangeRate");
Map(x => x.Debt, "Debt");
Map(x => x.Receivable, "Receivable");
Map(x => x.LocalDebt, "LocalDebt");
Map(x => x.LocalReceivable, "LocalReceivable");
Map(x => x.IsLock, "IsLock");
Map(x => x.Expiry, "Expiry");
Map(x => x.OpenBalance, "OpenBalance");
Map(x => x.LocalOpenBalance, "LocalOpenBalance");
References(x => x.Invoice, "InvoiceId");
References(x => x.Payment, "PaymentId");
References(x => x.Voucher, "VoucherId");
}
}
--
Atilla İlhan KARTAL
Web Application & Software Architect
(Java & PHP & Registered Android Developer)
Kuşadası / Aydın / Turkey
www.atillailhankartal.com.tr
twitter.com/TrojanMyth
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.