hi james, i have both situations.

1st: if i have a parent(DruckUndVersand) with
childs(RefDruckUndVersandFilter) and i call ISession.Delete(parent) i
get KeyNotFoundException.
2nd: if i have a parent(DruckUndVersand) with
childs(RefDruckUndVersandFilter) and i remove some child from the
parent collection and call ISession.SaveOrUpdate(parent) i get
KeyNotFoundException too.

somethin strange is that the generated sql would work... but commit
transaction give me the error.

how should my HasMany look like? i'm really new to nhibernate at all

below some additional information

StackTrace

bei System.Collections.Generic.Dictionary`2.get_Item(TKey key)
bei
NHibernate.Engine.StatefulPersistenceContext.RemoveEntity(EntityKey
key) in d:\CSharp\NH\nhibernate\src\NHibernate\Engine
\StatefulPersistenceContext.cs:Zeile 434.
bei NHibernate.Action.EntityDeleteAction.Execute() in d:\CSharp\NH
\nhibernate\src\NHibernate\Action\EntityDeleteAction.cs:Zeile 86.
bei NHibernate.Engine.ActionQueue.Execute(IExecutable executable) in d:
\CSharp\NH\nhibernate\src\NHibernate\Engine\ActionQueue.cs:Zeile 130.
bei NHibernate.Engine.ActionQueue.ExecuteActions(IList list) in d:
\CSharp\NH\nhibernate\src\NHibernate\Engine\ActionQueue.cs:Zeile 113.
bei NHibernate.Engine.ActionQueue.ExecuteActions() in d:\CSharp\NH
\nhibernate\src\NHibernate\Engine\ActionQueue.cs:Zeile 151.
bei
NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource
session) in d:\CSharp\NH\nhibernate\src\NHibernate\Event\Default
\AbstractFlushingEventListener.cs:Zeile 241.
bei
NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent
event) in d:\CSharp\NH\nhibernate\src\NHibernate\Event\Default
\DefaultFlushEventListener.cs:Zeile 19.
bei NHibernate.Impl.SessionImpl.Flush() in d:\CSharp\NH\nhibernate\src
\NHibernate\Impl\SessionImpl.cs:Zeile 1524.
bei NHibernate.Transaction.AdoTransaction.Commit() in d:\CSharp\NH
\nhibernate\src\NHibernate\Transaction\AdoTransaction.cs:Zeile 187.
bei
LFF.Kabu.Win.Tabellenverwaltung.DataAccess.NHibernate.UnitOfWork.CommitTransaction()
in C:\Demos\Tabellenverwaltung\DataAccess.NHibernate
\UnitOfWork.cs:Zeile 77.
bei
LFF.Kabu.Win.TabModul.DruckUndVersand.ViewModel.DruckUndVersandVM.SaveData()


nhibernate log

15:15:09.249 [17] DEBUG NHibernate.Transaction.AdoTransaction - Begin
(ReadCommitted)
15:15:09.249 [17] DEBUG NHibernate.Connection.DriverConnectionProvider
- Obtaining IDbConnection from Driver
15:15:09.249 [17] DEBUG
NHibernate.Event.Default.DefaultDeleteEventListener - deleting a
persistent instance
15:15:09.249 [17] DEBUG
NHibernate.Event.Default.DefaultDeleteEventListener - deleting
[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand#9]
15:15:09.249 [17] DEBUG NHibernate.Impl.SessionImpl - setting cache
mode to: Get
15:15:09.249 [17] INFO NHibernate.Engine.Cascade - processing cascade
NHibernate.Engine.CascadingAction+DeleteCascadingAction for:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand
15:15:09.249 [17] INFO NHibernate.Engine.Cascade - cascade
NHibernate.Engine.CascadingAction+DeleteCascadingAction for
collection:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefFilters
15:15:09.264 [17] DEBUG NHibernate.Engine.CascadingAction - cascading
to delete:
LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter
15:15:09.264 [17] DEBUG
NHibernate.Event.Default.DefaultDeleteEventListener - deleting a
persistent instance
15:15:09.264 [17] DEBUG
NHibernate.Event.Default.DefaultDeleteEventListener - deleting
[LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter#LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter]
15:15:09.264 [17] DEBUG NHibernate.Impl.SessionImpl - setting cache
mode to: Get
15:15:09.264 [17] DEBUG NHibernate.Impl.SessionImpl - setting cache
mode to: Get
15:15:09.264 [17] DEBUG NHibernate.Impl.SessionImpl - setting cache
mode to: Get
15:15:09.264 [17] DEBUG NHibernate.Impl.SessionImpl - setting cache
mode to: Get
15:15:09.264 [17] INFO NHibernate.Engine.Cascade - done cascade
NHibernate.Engine.CascadingAction+DeleteCascadingAction for
collection:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefFilters
15:15:09.264 [17] INFO NHibernate.Engine.Cascade - cascade
NHibernate.Engine.CascadingAction+DeleteCascadingAction for
collection:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben
15:15:09.264 [17] DEBUG
NHibernate.Event.Default.DefaultInitializeCollectionEventListener -
initializing collection
[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben#9]
15:15:09.264 [17] DEBUG
NHibernate.Event.Default.DefaultInitializeCollectionEventListener -
checking second-level cache
15:15:09.264 [17] DEBUG
NHibernate.Event.Default.DefaultInitializeCollectionEventListener -
collection not cached
15:15:09.264 [17] DEBUG NHibernate.Loader.Loader - loading collection:
[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben#9]
15:15:09.264 [17] DEBUG NHibernate.AdoNet.AbstractBatcher - Opened new
IDbCommand, open IDbCommands: 1
15:15:09.264 [17] DEBUG NHibernate.AdoNet.AbstractBatcher - Building
an IDbCommand object for the SqlString: SELECT
refdruckun0_.IDDruckUndVersand as IDDruckU1_1_, refdruckun0_.IDAUSGABE
as IDAUSGABE1_, refdruckun0_.IDDruckUndVersand as IDDruckU1_3_0_,
refdruckun0_.IDAUSGABE as IDAUSGABE3_0_,
refdruckun0_.OBAUTOMATISCHDRUCKEN as OBAUTOMA3_3_0_,
refdruckun0_.Druckerpfad as Druckerp4_3_0_, refdruckun0_.Beschreibung
as Beschrei5_3_0_ FROM REFDruckUndVersandAUSGABE refdruckun0_ WHERE
refdruckun0_.IDDruckUndVersand=?
15:15:09.264 [17] DEBUG NHibernate.Engine.QueryParameters -
BindParameters(Positional0:NHibernate.Type.Int64Type) 9 -> [0]
15:15:09.264 [17] DEBUG NHibernate.Type.Int64Type - binding '9' to
parameter: 0
15:15:09.264 [17] INFO NHibernate.Loader.Loader - SELECT
refdruckun0_.IDDruckUndVersand as IDDruckU1_1_, refdruckun0_.IDAUSGABE
as IDAUSGABE1_, refdruckun0_.IDDruckUndVersand as IDDruckU1_3_0_,
refdruckun0_.IDAUSGABE as IDAUSGABE3_0_,
refdruckun0_.OBAUTOMATISCHDRUCKEN as OBAUTOMA3_3_0_,
refdruckun0_.Druckerpfad as Druckerp4_3_0_, refdruckun0_.Beschreibung
as Beschrei5_3_0_ FROM REFDruckUndVersandAUSGABE refdruckun0_ WHERE
refdruckun0_.IDDruckUndVersand=:p0
15:15:09.264 [17] DEBUG NHibernate.SQL - SELECT
refdruckun0_.IDDruckUndVersand as IDDruckU1_1_, refdruckun0_.IDAUSGABE
as IDAUSGABE1_, refdruckun0_.IDDruckUndVersand as IDDruckU1_3_0_,
refdruckun0_.IDAUSGABE as IDAUSGABE3_0_,
refdruckun0_.OBAUTOMATISCHDRUCKEN as OBAUTOMA3_3_0_,
refdruckun0_.Druckerpfad as Druckerp4_3_0_, refdruckun0_.Beschreibung
as Beschrei5_3_0_ FROM REFDruckUndVersandAUSGABE refdruckun0_ WHERE
refdruckun0_.IDDruckUndVersand=:p0;:p0 = 9 [Type: Int64 (0)]
15:15:09.264 [17] DEBUG NHibernate.Transaction.AdoTransaction - Enlist
Command
15:15:09.264 [17] DEBUG NHibernate.AdoNet.AbstractBatcher -
ExecuteReader took 1 ms
15:15:09.264 [17] DEBUG NHibernate.AdoNet.AbstractBatcher - Opened
IDataReader, open IDataReaders: 1
15:15:09.264 [17] DEBUG NHibernate.Loader.Loader - result set contains
(possibly empty) collection:
[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben#9]
15:15:09.264 [17] DEBUG NHibernate.Engine.Loading.LoadContexts -
constructing collection load context for result set
[System.Data.OracleClient.OracleDataReader]
15:15:09.264 [17] DEBUG
NHibernate.Engine.Loading.CollectionLoadContext - starting attempt to
find loading collection
[[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben#9]]
15:15:09.264 [17] DEBUG NHibernate.Engine.Loading.LoadContexts -
attempting to locate loading collection entry
[CollectionKey[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben#9]]
in any result-set context
15:15:09.264 [17] DEBUG NHibernate.Engine.Loading.LoadContexts -
collection
[CollectionKey[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben#9]]
located in load context
15:15:09.264 [17] DEBUG
NHibernate.Engine.Loading.CollectionLoadContext - collection not yet
initialized; initializing
15:15:09.264 [17] DEBUG NHibernate.Loader.Loader - processing result
set
15:15:09.264 [17] DEBUG NHibernate.Loader.Loader - done processing
result set (0 rows)
15:15:09.264 [17] DEBUG NHibernate.AdoNet.AbstractBatcher - Closed
IDataReader, open IDataReaders :0
15:15:09.264 [17] DEBUG NHibernate.AdoNet.AbstractBatcher - DataReader
was closed after 2 ms
15:15:09.264 [17] DEBUG NHibernate.AdoNet.AbstractBatcher - Closed
IDbCommand, open IDbCommands: 0
15:15:09.264 [17] DEBUG NHibernate.Loader.Loader - total objects
hydrated: 0
15:15:09.264 [17] DEBUG NHibernate.Engine.Loading.LoadContexts -
attempting to locate loading collection entry
[CollectionKey[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben#9]]
in any result-set context
15:15:09.264 [17] DEBUG NHibernate.Engine.Loading.LoadContexts -
collection
[CollectionKey[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben#9]]
not located in load context
15:15:09.264 [17] DEBUG
NHibernate.Engine.Loading.CollectionLoadContext - removing collection
load entry
[NHibernate.Engine.Loading.LoadingCollectionEntry<rs=System.Data.OracleClient.OracleDataReader,
coll=[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben#9]>@69a2a7]
15:15:09.264 [17] DEBUG
NHibernate.Engine.Loading.CollectionLoadContext - 1 collections were
found in result set for role:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben
15:15:09.264 [17] DEBUG
NHibernate.Engine.Loading.CollectionLoadContext - ending loading
collection
[NHibernate.Engine.Loading.LoadingCollectionEntry<rs=System.Data.OracleClient.OracleDataReader,
coll=[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben#9]>@69a2a7]
15:15:09.264 [17] DEBUG
NHibernate.Engine.Loading.CollectionLoadContext - collection fully
initialized:
[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben#9]
15:15:09.264 [17] DEBUG
NHibernate.Engine.Loading.CollectionLoadContext - 1 collections
initialized for role:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben
15:15:09.264 [17] DEBUG NHibernate.Engine.StatefulPersistenceContext -
initializing non-lazy collections
15:15:09.264 [17] DEBUG NHibernate.Loader.Loader - done loading
collection
15:15:09.264 [17] DEBUG
NHibernate.Event.Default.DefaultInitializeCollectionEventListener -
collection initialized
15:15:09.264 [17] INFO NHibernate.Engine.Cascade - done cascade
NHibernate.Engine.CascadingAction+DeleteCascadingAction for
collection:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben
15:15:09.264 [17] INFO NHibernate.Engine.Cascade - done processing
cascade NHibernate.Engine.CascadingAction+DeleteCascadingAction for:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand
15:15:09.264 [17] DEBUG NHibernate.Impl.SessionImpl - setting cache
mode to: Normal
15:15:09.264 [17] DEBUG NHibernate.Impl.SessionImpl - setting cache
mode to: Get
15:15:09.264 [17] INFO NHibernate.Engine.Cascade - processing cascade
NHibernate.Engine.CascadingAction+DeleteCascadingAction for:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand
15:15:09.264 [17] INFO NHibernate.Engine.Cascade - done processing
cascade NHibernate.Engine.CascadingAction+DeleteCascadingAction for:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand
15:15:09.264 [17] DEBUG NHibernate.Impl.SessionImpl - setting cache
mode to: Normal
15:15:09.264 [17] DEBUG NHibernate.Transaction.AdoTransaction - Start
Commit
15:15:09.264 [17] DEBUG
NHibernate.Event.Default.AbstractFlushingEventListener - flushing
session
15:15:09.264 [17] DEBUG
NHibernate.Event.Default.AbstractFlushingEventListener - processing
flush-time cascades
15:15:09.264 [17] INFO NHibernate.Engine.Cascade - processing cascade
NHibernate.Engine.CascadingAction+SaveUpdateCascadingAction for:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand
15:15:09.264 [17] INFO NHibernate.Engine.Cascade - cascade
NHibernate.Engine.CascadingAction+SaveUpdateCascadingAction for
collection:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefFilters
15:15:09.264 [17] INFO NHibernate.Engine.Cascade - done cascade
NHibernate.Engine.CascadingAction+SaveUpdateCascadingAction for
collection:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefFilters
15:15:09.264 [17] INFO NHibernate.Engine.Cascade - cascade
NHibernate.Engine.CascadingAction+SaveUpdateCascadingAction for
collection:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben
15:15:09.264 [17] INFO NHibernate.Engine.Cascade - done cascade
NHibernate.Engine.CascadingAction+SaveUpdateCascadingAction for
collection:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben
15:15:09.264 [17] INFO NHibernate.Engine.Cascade - done processing
cascade NHibernate.Engine.CascadingAction+SaveUpdateCascadingAction
for: LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand
15:15:09.264 [17] INFO NHibernate.Engine.Cascade - processing cascade
NHibernate.Engine.CascadingAction+SaveUpdateCascadingAction for:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand
15:15:09.264 [17] INFO NHibernate.Engine.Cascade - cascade
NHibernate.Engine.CascadingAction+SaveUpdateCascadingAction for
collection:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefFilters
15:15:09.264 [17] DEBUG NHibernate.Engine.CascadingAction - cascading
to saveOrUpdate:
LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter
15:15:09.296 [17] DEBUG
NHibernate.Event.Default.AbstractSaveEventListener - persistent
instance of:
LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter
15:15:09.296 [17] DEBUG
NHibernate.Event.Default.DefaultSaveOrUpdateEventListener - ignoring
persistent instance
15:15:09.296 [17] DEBUG
NHibernate.Event.Default.DefaultSaveOrUpdateEventListener - object
already associated with session:
[LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter#LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter]
15:15:09.296 [17] INFO NHibernate.Engine.Cascade - done cascade
NHibernate.Engine.CascadingAction+SaveUpdateCascadingAction for
collection:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefFilters
15:15:09.296 [17] INFO NHibernate.Engine.Cascade - cascade
NHibernate.Engine.CascadingAction+SaveUpdateCascadingAction for
collection:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben
15:15:09.296 [17] INFO NHibernate.Engine.Cascade - done cascade
NHibernate.Engine.CascadingAction+SaveUpdateCascadingAction for
collection:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben
15:15:09.296 [17] INFO NHibernate.Engine.Cascade - done processing
cascade NHibernate.Engine.CascadingAction+SaveUpdateCascadingAction
for: LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand
15:15:09.296 [17] INFO NHibernate.Engine.Cascade - processing cascade
NHibernate.Engine.CascadingAction+SaveUpdateCascadingAction for:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand
15:15:09.296 [17] INFO NHibernate.Engine.Cascade - cascade
NHibernate.Engine.CascadingAction+SaveUpdateCascadingAction for
collection:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefFilters
15:15:09.296 [17] DEBUG NHibernate.Engine.CascadingAction - cascading
to saveOrUpdate:
LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter
15:15:09.296 [17] DEBUG
NHibernate.Event.Default.AbstractSaveEventListener - persistent
instance of:
LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter
15:15:09.296 [17] DEBUG
NHibernate.Event.Default.DefaultSaveOrUpdateEventListener - ignoring
persistent instance
15:15:09.296 [17] DEBUG
NHibernate.Event.Default.DefaultSaveOrUpdateEventListener - object
already associated with session:
[LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter#LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter]
15:15:09.296 [17] DEBUG NHibernate.Engine.CascadingAction - cascading
to saveOrUpdate:
LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter
15:15:09.296 [17] DEBUG
NHibernate.Event.Default.AbstractSaveEventListener - persistent
instance of:
LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter
15:15:09.296 [17] DEBUG
NHibernate.Event.Default.DefaultSaveOrUpdateEventListener - ignoring
persistent instance
15:15:09.296 [17] DEBUG
NHibernate.Event.Default.DefaultSaveOrUpdateEventListener - object
already associated with session:
[LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter#LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter]
15:15:09.296 [17] INFO NHibernate.Engine.Cascade - done cascade
NHibernate.Engine.CascadingAction+SaveUpdateCascadingAction for
collection:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefFilters
15:15:09.296 [17] INFO NHibernate.Engine.Cascade - cascade
NHibernate.Engine.CascadingAction+SaveUpdateCascadingAction for
collection:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben
15:15:09.296 [17] INFO NHibernate.Engine.Cascade - done cascade
NHibernate.Engine.CascadingAction+SaveUpdateCascadingAction for
collection:
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben
15:15:09.296 [17] INFO NHibernate.Engine.Cascade - done processing
cascade NHibernate.Engine.CascadingAction+SaveUpdateCascadingAction
for: LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand
15:15:09.296 [17] DEBUG
NHibernate.Event.Default.AbstractFlushingEventListener - dirty
checking collections
15:15:09.296 [17] DEBUG
NHibernate.Event.Default.AbstractFlushingEventListener - Flushing
entities and processing referenced collections
15:15:09.296 [17] DEBUG NHibernate.Engine.Collections - Collection
found:
[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefFilters#8],
was:
[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefFilters#8]
(initialized)
15:15:09.296 [17] DEBUG NHibernate.Engine.Collections - Collection
found:
[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben#8],
was:
[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben#8]
(uninitialized)
15:15:09.296 [17] DEBUG NHibernate.Engine.Collections - Collection
found:
[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefFilters#1],
was:
[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefFilters#1]
(initialized)
15:15:09.296 [17] DEBUG NHibernate.Engine.Collections - Collection
found:
[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben#1],
was:
[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben#1]
(uninitialized)
15:15:09.296 [17] DEBUG NHibernate.Engine.Collections - Collection
found:
[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefFilters#3],
was:
[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefFilters#3]
(initialized)
15:15:09.296 [17] DEBUG NHibernate.Engine.Collections - Collection
found:
[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben#3],
was:
[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben#3]
(uninitialized)
15:15:09.296 [17] DEBUG
NHibernate.Event.Default.AbstractFlushingEventListener - Processing
unreferenced collections
15:15:09.296 [17] DEBUG NHibernate.Engine.Collections - Collection
dereferenced:
[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefFilters#9]
15:15:09.296 [17] DEBUG NHibernate.Engine.Collections - Collection
dereferenced:
[LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand.RefDruckUndVersandAusgaben#9]
15:15:09.296 [17] DEBUG
NHibernate.Event.Default.AbstractFlushingEventListener - Scheduling
collection removes/(re)creates/updates
15:15:09.296 [17] DEBUG
NHibernate.Event.Default.AbstractFlushingEventListener - Flushed: 0
insertions, 0 updates, 2 deletions to 8 objects
15:15:09.296 [17] DEBUG
NHibernate.Event.Default.AbstractFlushingEventListener - Flushed: 0
(re)creations, 0 updates, 2 removals to 8 collections
15:15:09.296 [17] DEBUG NHibernate.Impl.Printer - listing entities:
15:15:09.296 [17] DEBUG NHibernate.Impl.Printer -
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand{'Id'='8',
'RefFilters'='[]', 'RefDruckUndVersandAusgaben'='<uninitialized>',
'Programm'='Datenblatt', 'Variante'='Buchungslauf',
'Beschreibung'=null, 'IsActive'='False'}
15:15:09.296 [17] DEBUG NHibernate.Impl.Printer -
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand{'Id'='9',
'RefFilters'='['LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter']',
'RefDruckUndVersandAusgaben'='[]', 'Programm'='Datenblatt',
'Variante'='Buchungslauf', 'Beschreibung'=null, 'IsActive'='False'}
15:15:09.296 [17] DEBUG NHibernate.Impl.Printer -
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand{'Id'='1',
'RefFilters'='['LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter']',
'RefDruckUndVersandAusgaben'='<uninitialized>',
'Programm'='Zahlungsanzeigen', 'Variante'='Maschinell',
'Beschreibung'=null, 'IsActive'='True'}
15:15:09.296 [17] DEBUG NHibernate.Impl.Printer -
LFF.Kabu.Win.Tabellenverwaltung.Entities.DruckUndVersand{'Id'='3',
'RefFilters'='['LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter',
'LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter']',
'RefDruckUndVersandAusgaben'='<uninitialized>',
'Programm'='MonatlicheKontoauszüge', 'Variante'='Maschinell',
'Beschreibung'=null, 'IsActive'='True'}
15:15:09.296 [17] DEBUG NHibernate.Impl.Printer -
LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter{'Filter'='01'}
15:15:09.296 [17] DEBUG NHibernate.Impl.Printer -
LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter{'Filter'='A998'}
15:15:09.296 [17] DEBUG NHibernate.Impl.Printer -
LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter{'Filter'='01'}
15:15:09.296 [17] DEBUG NHibernate.Impl.Printer -
LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter{'Filter'='0304'}
15:15:09.296 [17] DEBUG
NHibernate.Event.Default.AbstractFlushingEventListener - executing
flush
15:15:09.296 [17] DEBUG NHibernate.AdoNet.ConnectionManager -
registering flush begin
15:15:09.311 [17] DEBUG
NHibernate.Persister.Entity.AbstractEntityPersister - Deleting entity:
[LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter#LFF.Kabu.Win.Tabellenverwaltung.Entities.RefDruckUndVersandFilter]
15:15:09.311 [17] DEBUG NHibernate.AdoNet.AbstractBatcher - Opened new
IDbCommand, open IDbCommands: 1
15:15:09.311 [17] DEBUG NHibernate.AdoNet.AbstractBatcher - Building
an IDbCommand object for the SqlString: DELETE FROM
REFDruckUndVersandFILTER WHERE IDDruckUndVersand = ? AND FILTERRANK
= ?
15:15:09.311 [17] DEBUG NHibernate.Type.Int64Type - binding '9' to
parameter: 0
15:15:09.311 [17] DEBUG NHibernate.Type.Int64Type - binding '1' to
parameter: 1
15:15:09.311 [17] DEBUG NHibernate.SQL - DELETE FROM
REFDruckUndVersandFILTER WHERE IDDruckUndVersand = :p0 AND FILTERRANK
= :p1;:p0 = 9 [Type: Int64 (0)], :p1 = 1 [Type: Int64 (0)]
15:15:09.311 [17] DEBUG NHibernate.Transaction.AdoTransaction - Enlist
Command
15:15:09.311 [17] DEBUG NHibernate.AdoNet.AbstractBatcher -
ExecuteNonQuery took 1 ms
15:15:09.342 [17] DEBUG NHibernate.AdoNet.ConnectionManager -
registering flush end
15:15:12.448 [17] DEBUG NHibernate.Transaction.AdoTransaction -
Rollback
15:15:12.464 [17] DEBUG NHibernate.Transaction.AdoTransaction -
IDbTransaction RolledBack
15:15:12.464 [17] DEBUG NHibernate.Transaction.AdoTransaction -
IDbTransaction disposed.
15:15:12.464 [17] DEBUG NHibernate.Impl.SessionImpl - transaction
completion
15:15:12.464 [17] DEBUG NHibernate.AdoNet.ConnectionManager -
aggressively releasing database connection
15:15:12.464 [17] DEBUG NHibernate.Connection.ConnectionProvider -
Closing connection

On 24 Okt., 12:09, James Gregory <jagregory....@gmail.com> wrote:
> How are you deleting the entities? Are you removing them from the collection
> on DruckUndVersand or deleting them directly using Session.Delete?
>
> If it's from the collection, it could be because your HasMany only specifies
> one column for the key while your mapping specifies two.
>
>
>
>
>
>
>
> On Fri, Oct 22, 2010 at 9:58 AM, Frank <blindm...@googlemail.com> wrote:
> > hi. i use oracle and nhibernate3 alpha. i have a parent child
> > relation. the child table has a composite id. Select, insert and
> > update records works, but deleting a parent with childs or just delete
> > a child throws a KeyNotFoundException. it seems i miss something in my
> > mapping?
>
> > below my entity classes and mappings
>
> > public class DruckUndVersand
> > {
> >    public DruckUndVersand()
> >    {
> >        this.RefFilters = new List<RefDruckUndVersandFilter>();
> >    }
>
> >    public virtual long Id { get; set; }
> >    public virtual string Programm { get; set; }
> >    public virtual string Variante { get; set; }
> >    public virtual string Beschreibung { get; set; }
> >    public virtual bool IsActive { get; set; }
> >    public virtual IList<RefDruckUndVersandFilter> RefFilters { get;
> > set; }
> > }
>
> > public class RefDruckUndVersandFilter
> > {
> >    public virtual DruckUndVersand DruckUndVersand { get; set; }
> >    public virtual long Rank { get; set; }
> >    public virtual string Filter { get; set; }
>
> >    #region override Equals(), GetHashCode()
> >    //
> >    #endregion
> > }
> > my fluent mappings look like this:
>
> > public class DruckUndVersandMapper : ClassMap<DruckUndVersand>
> > {
> >    public DruckUndVersandMapper()
> >    {
> >        Table("Tab_DruckUndVersand");
> >        Id(x => x.Id,
> > "ID").GeneratedBy.Sequence("SEQ_DruckUndVersand");
>
> >        Map(x => x.Programm).Not.Nullable().Length(255);
> >        Map(x => x.Variante).Length(255);
> >        Map(x => x.Beschreibung).Length(255);
> >        Map(x =>
> > x.IsActive).Column("ISACTIVE").CustomType<YesNoType>().Length(1);
>
> >        HasMany(x => x.RefFilters)
> >            .KeyColumn("IDDruckUndVersand")
> >            .NotFound.Ignore()
> >            .Inverse()
> >            .Cascade.All()
> >            ;
> >    }
> > }
>
> > public class RefDruckUndVersandFilterMapper :
> > ClassMap<RefDruckUndVersandFilter>
> > {
> >    public RefDruckUndVersandFilterMapper()
> >    {
> >        Table("REFDruckUndVersandFILTER");
> >        Not.LazyLoad();
> >        Map(x => x.Filter);
> >        CompositeId()
> >            .KeyReference(x => x.DruckUndVersand, "IDDruckUndVersand")
> >            .KeyProperty(x => x.Rank, "FILTERRANK");
>
> >    }
> > }
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Fluent NHibernate" group.
> > To post to this group, send email to fluent-nhibern...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2Bunsubscr 
> > i...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/fluent-nhibernate?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibern...@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to