Are you joking ? Session.Save(Session.Save(o)); // throws exception what you are expecting from that sentence ?
2009/10/19 Scott White <[email protected]> > > What could go wrong that would cause NHibernate to not know the > persister for intrinsic types like Int64? > > exception: No persister for: System.Int64 > > IList<Deposit> list = new List<Deposit>(); > list.Add(new Deposit()); > > foreach (Deposit o in list) > { > Session.Save(new Deposit()); // works > Session.Save(Session.Save(o)); // throws exception > (No persister for: System.Int64) > > > Stack Trace: > " at NHibernate.Impl.SessionFactoryImpl.GetEntityPersister(String > entityName)\r\n at NHibernate.Impl.SessionImpl.GetEntityPersister > (String entityName, Object obj)\r\n at > NHibernate.Event.Default.AbstractSaveEventListener.SaveWithGeneratedId > (Object entity, String entityName, Object anything, IEventSource > source, Boolean requiresImmediateIdAccess)\r\n at > > NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.SaveWithGeneratedOrRequestedId > (SaveOrUpdateEvent event)\r\n at > > NHibernate.Event.Default.DefaultSaveEventListener.SaveWithGeneratedOrRequestedId > (SaveOrUpdateEvent event)\r\n at > NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient > (SaveOrUpdateEvent event)\r\n at > NHibernate.Event.Default.DefaultSaveEventListener.PerformSaveOrUpdate > (SaveOrUpdateEvent event)\r\n at > NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate > (SaveOrUpdateEvent event)\r\n at NHibernate.Impl.SessionImpl.FireSave > (SaveOrUpdateEvent event)\r\n at NHibernate.Impl.SessionImpl.Save > (Object obj)\r\n at > Company.CashManagement.Data.Test.CashTransactionDao_Tests.Initialize() > in C:\\dev\\Portal\\src\\trunk\\Company.CashManagement.Data.Test\ > \CashTransactionDao_Tests.cs:line 62" > > MAPPING > > <?xml version="1.0" encoding="utf-8"?> > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> > <class > > name="Company.CashManagement.Domain.CashTransaction,Company.CashManagement.Domain" > table="FactTransaction" mutable="false" discriminator-value="0"> > <id name="Id" column="FactTransactionID" type="long"> > <generator class="native" /> > </id> > <discriminator formula="case when DimTransactionTypeID in (3, 4) > then 1 else 0 end" /> > <!-- <discriminator column="DimTransactionTypeID" type="short" />-- > > > > <property name="Agent" column="Agent" type="string" length="10" /> > <property name="BranchId" column="BranchID" type="int" /> > <property name="CheckCount" column="CheckCnt" type="int" not- > null="true" /> > <property name="Checks" column="Checks" type="Decimal" not- > null="true" /> > <property name="CoinTotal" column="CoinTotal" type="Decimal" not- > null="true" /> > <property name="CreatedDate" column="RecordCreateDateTime" > type="DateTime" /> > <property name="CreditedDate" column="CreditDate" type="DateTime" / > > > <property name="CurrencyTotal" column="CurrencyTotal" > type="Decimal" not-null="true" /> > <property name="CustomPrompt1" column="Custom_Prompt_1" > type="int" /> > <property name="CustomPrompt2" column="Custom_Prompt_2" > type="int" /> > <property name="CustomPrompt3" column="Custom_Prompt_3" > type="int" /> > <property name="CustomPrompt10" column="Custom_Prompt_10" > type="int" /> > <property name="CustomPrompt11" column="Custom_Prompt_11" > type="int" /> > <property name="DeclaredCash" column="DeclaredCash" > type="Decimal" /> > <property name="DeclaredItem" column="DeclaredItem" > type="Decimal" /> > <property name="DeclaredTotal" column="DeclaredTotal" > type="Decimal" not-null="true" /> > <property name="DenominationBase" column="DenominationBase" > type="string" length="50" /> > <property name="DepositId" column="DepositID" type="string" > length="20" /> > <property name="Difference" column="Difference" type="Decimal" not- > null="true" /> > <property name="EmployeeNumber" column="EmployeeNumber" > type="int" /> > <property name="EnvelopeCount" column="EnvelopeCnt" type="int" not- > null="true" /> > <property name="FoodStamps" column="FoodStamps" type="Decimal" not- > null="true" /> > <property name="IsMasterBag" column="IsMasterBag" type="Boolean" / > > > <property name="IsOffset" column="IsOffset" type="Boolean" /> > <property name="LastModifiedDate" column="RecordUpdateDateTime" > type="DateTime" /> > <many-to-one name="Location" column="DimAccntLocID" /> > <property name="LocationNumber" column="LocationNumber" > type="long" /> > <property name="LogDate" column="LogDate" type="date" /> > <property name="LogTime" column="LogTime" type="time" /> > <property name="LoosePiecesCountTotal" > column="LoosePiecesCntTotal" type="long" not-null="true" /> > <property name="Memo" column="Memo" type="string" length="100" /> > <property name="MultiVaultId" column="MVID" type="long" /> > <property name="NonStandardCoinBags" column="NonStandardCoinBags" > type="int" not-null="true" /> > <property name="OtherMisc" column="OtherMisc" type="Decimal" not- > null="true" /> > <property name="ProcessedDate" column="ProcessingDate" > type="DateTime" /> > <property name="ProcessedMode" column="ProcessMode" type="byte" /> > <property name="SerialNo" column="SerialNo" type="string" > length="10" /> > <property name="StandardCoinBags" column="StandardCoinBags" > type="int" not-null="true" /> > <property name="ServicedDate" column="AccntLocDate" > type="DateTime" /> > <property name="StandardStrapsCount" column="StandardStraps" > type="int" not-null="true" /> > <property name="StrapPiecesCountTotal" > column="StrapPiecesCntTotal" type="int" not-null="true" /> > <property name="TraceNo" column="TraceNo" type="long" /> > <property name="TraceNoMasterBag" column="TraceNo_MasterBag" > type="long" /> > <property name="TraceNoMbd" column="TraceNo_MBD" type="long" /> > <property name="TransactionTypeId" column="DimTransactionTypeID" > type="short" not-null="true" /> > <property name="VerifiedCash" column="VerifiedCash" type="Decimal" > not-null="true" /> > <property name="VerifiedTotal" column="VerifiedTotal" > type="Decimal" not-null="true" /> > <property name="WrappedCoinCount" column="WrappedCoinCount" > type="int" not-null="true" /> > > <bag name="ReasonCodes" inverse="true"> > <key column="FactTransactionID" /> > <one-to-many > > class="Company.CashManagement.Domain.ReasonCode,Company.CashManagement.Domain"/ > > > </bag> > > <!-- Components --> > <component name="DenominationalBillAmounts" > > class="Company.CashManagement.Domain.DenominationalBillAmount,Company.CashManagement.Domain"> > <property name="One" column="Bill_0001_00" type="Decimal" not- > null="true" /> > <property name="Two" column="Bill_0002_00" type="Decimal" not- > null="true" /> > <property name="Five" column="Bill_0005_00" type="Decimal" not- > null="true" /> > <property name="Ten" column="Bill_0010_00" type="Decimal" not- > null="true" /> > <property name="Twenty" column="Bill_0020_00" type="Decimal" not- > null="true" /> > <property name="Fifty" column="Bill_0050_00" type="Decimal" not- > null="true" /> > <property name="OneHundred" column="Bill_0100_00" type="Decimal" > not-null="true" /> > <property name="TwoHundred" column="Bill_0200_00" type="Decimal" > not-null="true" /> > <property name="FiveHundred" column="Bill_0500_00" > type="Decimal" not-null="true" /> > <property name="OneThousand" column="Bill_1000_00" > type="Decimal" not-null="true" /> > </component> > <component name="DenominationalCoinAmounts" > > class="Company.CashManagement.Domain.DenominationalCoinAmount,Company.CashManagement.Domain"> > <property name="Loose" column="Coin_Loose" type="Decimal" not- > null="true" /> > <property name="Penny" column="Coin_0000_01" type="Decimal" not- > null="true" /> > <property name="Nickel" column="Coin_0000_05" type="Decimal" not- > null="true" /> > <property name="Dime" column="Coin_0000_10" type="Decimal" not- > null="true" /> > <property name="Quarter" column="Coin_0000_25" type="Decimal" > not-null="true" /> > <property name="FiftyCentPiece" column="Coin_0000_50" > type="Decimal" not-null="true" /> > <property name="DollarPiece" column="Coin_0001_00" > type="Decimal" not-null="true" /> > </component> > <component name="DenominationalFoodStampAmounts" > > class="Company.CashManagement.Domain.DenominationalFoodStampAmount,Company.CashManagement.Domain"> > <property name="One" column="FS_0001_00" type="Decimal" not- > null="true" /> > <property name="Five" column="FS_0005_00" type="Decimal" not- > null="true" /> > <property name="Ten" column="FS_0010_00" type="Decimal" not- > null="true" /> > <property name="Loose" column="FS_Loose" type="Decimal" not- > null="true" /> > </component> > <component name="DenominationalNoteCounts" > > class="Company.CashManagement.Domain.DenominationalNoteCount,Company.CashManagement.Domain"> > <property name="One" column="note_count_1" type="int" not- > null="true" /> > <property name="Two" column="note_count_2" type="int" not- > null="true" /> > <property name="Five" column="note_count_5" type="int" not- > null="true" /> > <property name="Ten" column="note_count_10" type="int" not- > null="true" /> > <property name="Twenty" column="note_count_20" type="int" not- > null="true" /> > <property name="Fifty" column="note_count_50" type="int" not- > null="true" /> > <property name="Hundred" column="note_count_100" type="int" not- > null="true" /> > </component> > <component name="DenominationalMutilatedAmounts" > > class="Company.CashManagement.Domain.DenominationalBillAmount,Company.CashManagement.Domain"> > <property name="One" column="Mute_0001_00" type="Decimal" not- > null="true" /> > <property name="Two" column="Mute_0002_00" type="Decimal" not- > null="true" /> > <property name="Five" column="Mute_0005_00" type="Decimal" not- > null="true" /> > <property name="Ten" column="Mute_0010_00" type="Decimal" not- > null="true" /> > <property name="Twenty" column="Mute_0020_00" type="Decimal" not- > null="true" /> > <property name="Fifty" column="Mute_0050_00" type="Decimal" not- > null="true" /> > <property name="OneHundred" column="Mute_0100_00" type="Decimal" > not-null="true" /> > <property name="TwoHundred" column="Mute_0200_00" type="Decimal" > not-null="true" /> > <property name="FiveHundred" column="Mute_0500_00" > type="Decimal" not-null="true" /> > <property name="OneThousand" column="Mute_1000_00" > type="Decimal" not-null="true" /> > </component> > > <!-- Sub Classes --> > <subclass > name="Company.CashManagement.Domain.Deposit,Company.CashManagement.Domain" > discriminator-value="1"> > <property name="MicrData" column="MicrData" type="string" > length="80" /> > </subclass> > </class> > </hibernate-mapping> > > POCO > > using System; > using System.Collections.Generic; > using Company.Domain.Common; > > namespace Company.CashManagement.Domain > { > /// <summary> > /// Represents a Transaction related to the Cash Management > system. > /// </summary> > public abstract class CashTransaction : BaseBusinessId64 > { > public virtual string Agent { get; set; } > > public virtual int? BranchId { get; set; } > > public virtual int CheckCount { get; set; } > > public virtual decimal Checks { get; set; } > > public virtual decimal CoinTotal { get; set; } > > public virtual DateTime? CreatedDate { get; set; } > > public virtual DateTime? CreditedDate { get; set; } > > public virtual decimal CurrencyTotal { get; set; } > > public virtual int? CustomPrompt1 { get; set; } > > public virtual int? CustomPrompt2 { get; set; } > > public virtual int? CustomPrompt3 { get; set; } > > public virtual int? CustomPrompt10 { get; set; } > > public virtual int? CustomPrompt11 { get; set; } > > public virtual decimal? DeclaredCash { get; set; } > > public virtual decimal? DeclaredItem { get; set; } > > public virtual decimal DeclaredTotal { get; set; } > > public virtual DenominationalBillAmount > DenominationalBillAmounts { get; set; } > > public virtual DenominationalCoinAmount > DenominationalCoinAmounts { get; set; } > > public virtual DenominationalFoodStampAmount > DenominationalFoodStampAmounts { get; set; } > > public virtual DenominationalNoteCount > DenominationalNoteCounts { get; set; } > > public virtual DenominationalBillAmount > DenominationalMutilatedAmounts { get; set; } > > public virtual string DenominationBase { get; set; } > > public virtual string DepositId { get; set; } > > public virtual decimal Difference { get; set; } > > public virtual int? EmployeeNumber { get; set; } > > public virtual int EnvelopeCount { get; set; } > > public virtual decimal FoodStamps { get; set; } > > public virtual bool? IsMasterBag { get; set; } > > public virtual bool IsOffset { get; set; } > > public virtual DateTime? LastModifiedDate { get; set; } > > public virtual AccountLocation Location { get; set; } > > public virtual long? LocationNumber { get; set; } > > public virtual DateTime? LogDate { get; set; } > > public virtual TimeSpan? LogTime { get; set; } > > public virtual DateTime? LogDateAndTime > { > get > { > return LogDate != null && LogTime != null ? new > DateTime(LogDate.Value.Ticks + LogTime.Value.Ticks) : (DateTime?)null; > } > } > > public virtual long LoosePiecesCountTotal { get; set; } > > public virtual string Memo { get; set; } > > public virtual long? MultiVaultId { get; set; } > > public virtual int NonStandardCoinBags { get; set; } > > public virtual decimal OtherMisc { get; set; } > > public virtual DateTime ProcessedDate { get; set; } > > public virtual byte? ProcessedMode { get; set; } > > public virtual IList<ReasonCode> ReasonCodes { get; set; } > > public virtual string SerialNo { get; set; } > > public virtual DateTime? ServicedDate { get; set; } > > public virtual int StandardCoinBags { get; set; } > > public virtual int StandardStrapsCount { get; set; } > > public virtual int StrapPiecesCountTotal { get; set; } > > public virtual long? TraceNo { get; set; } > > public virtual long? TraceNoMasterBag { get; set; } > > public virtual long? TraceNoMbd { get; set; } > > public virtual short TransactionTypeId { get; set; } > > public virtual decimal VerifiedCash { get; set; } > > public virtual decimal VerifiedTotal { get; set; } > > public virtual int WrappedCoinCount { get; set; } > } > > public class Deposit : CashTransaction > { > public virtual string MicrData { get; set; } > } > } > > > > -- Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
