-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: ISession.Load method and one-to-many relationships
PostPosted: Fri Jun 17, 2005 6:27 am 
I've searched high and low for information on this but if anyone else has found info. please feel free to point me to it. I'm not a database person so excuse the simplicity :) but I like testing new db techs. on my simple CD database.

So I have a CD database, which has a CD table with a one-to-many relationship to a Track table, i.e. a CD contains many tracks (told you it was simple). A CD also includes a couple of fields (Artist and Title).

Anyway, in code I have my CD class with an IList Tracks property to hold the list of tracks for the CD.

Now when using:

ICriteria criteria = session.CreateCriteria(typeof(CD));
IList list = criteria.List();

I get back a list of CD's and each CD has an IList full of the tracks for the relevent CD. In other words if I itterate through the list and get each CD then itterate through the Track IList , I will have the tracks for that CD loaded into the class heirarchy. However...

If I use:

CD cd = (CD)session.Load(typeof(CD), "ABCDEFG");

to get a specific CD (where "ABCDEFG" is a valid key value), I do still get the CD information back correctly (such as Artist and Title) but the Tracks (IList) property is always empty ?

So the real questions are, is this by design, am I doing something wrong/missing something, or dare I suggest on such an excellent library, is it a bug. I have had a quick look over the bug tracker for NHibernate, but didn't spot anything.

Everything else appears to be working well, it's just this one oddity that I'm stuck on - thanks


Top
  
 
 Post subject:
PostPosted: Fri Jun 17, 2005 12:56 pm 
Expert
Expert

Joined: Fri May 13, 2005 5:56 pm
Posts: 308
Location: Santa Barbara, California, USA
post your mapping file for the CD object, please.

cheers,

-devon


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 17, 2005 1:33 pm 
Here's the CD mapping:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="mtbsoftware.CD, cddb" table="tblCD">
<id name="DiscId" column="DiscId">
<generator class="assigned" />
</id>
<property name="Artist" column="Artist"/>
<property name="Title" column="Title"/>
<many-to-one name="Style" column="Style" class="mtbsoftware.Style, cddb" cascade="none" />
<bag name="Tracks" cascade="all" lazy="false" inverse="true">
<key column="DiscId" />
<one-to-many class="mtbsoftware.Track, cddb" />
</bag>
</class>
</hibernate-mapping>

and here's the track

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="mtbsoftware.Track, cddb" table="tblTrack">
<id name="Id" column="Id">
<generator class="native" />
</id>
<property name="Name" column="Name"/>
<property name="Duration" column="Duration"/>
<many-to-one name="CD" column="DiscId" class="mtbsoftware.CD, cddb" cascade="none" />
</class>
</hibernate-mapping>

Any help gratefully received


Top
  
 
 Post subject:
PostPosted: Fri Jun 17, 2005 2:05 pm 
Expert
Expert

Joined: Fri May 13, 2005 5:56 pm
Posts: 308
Location: Santa Barbara, California, USA
hmmm... can you post the generated SQL statement from the debugging log? that mapping looks fine although I've never set cascade="none" on the m-1 relationship...

-devon


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 17, 2005 3:03 pm 
I think this is what you want

2005-06-17 19:54:51,421 [3480] INFO NHibernate.Impl.BatcherImpl [] <> - Preparing SELECT tracks0_.DiscId as DiscId__, tracks0_.Id as Id__, tracks0_.Id as Id0_, tracks0_.Duration as Duration0_, tracks0_.Name as Name0_, tracks0_.DiscId as DiscId0_ FROM tblTrack tracks0_ WHERE tracks0_.DiscId = @p0

However, I hope you don't mind I've listed the whole of the log file in case this helps:

2005-06-17 19:54:43,421 [3480] INFO NHibernate.Cfg.Configuration [] <> - Found mapping documents in assembly: cddb.Style.Style.hbm.xml
2005-06-17 19:54:43,640 [3480] INFO NHibernate.Dialect.Dialect [] <> - Using dialect: NHibernate.Dialect.MsSql2000Dialect
2005-06-17 19:54:43,703 [3480] INFO NHibernate.Cfg.Binder [] <> - Mapping class: mtbsoftware.Style -> tblStyle
2005-06-17 19:54:43,765 [3480] DEBUG NHibernate.Cfg.Binder [] <> - Mapped property: Name -> Name, type: String
2005-06-17 19:54:43,812 [3480] DEBUG NHibernate.Cfg.Binder [] <> - Mapped property: CDs, type: ICollection
2005-06-17 19:54:43,812 [3480] INFO NHibernate.Cfg.Configuration [] <> - Found mapping documents in assembly: cddb.CD.CD.hbm.xml
2005-06-17 19:54:43,812 [3480] INFO NHibernate.Dialect.Dialect [] <> - Using dialect: NHibernate.Dialect.MsSql2000Dialect
2005-06-17 19:54:43,812 [3480] INFO NHibernate.Cfg.Binder [] <> - Mapping class: mtbsoftware.CD -> tblCD
2005-06-17 19:54:43,812 [3480] DEBUG NHibernate.Cfg.Binder [] <> - Mapped property: DiscId -> DiscId, type: String
2005-06-17 19:54:43,812 [3480] DEBUG NHibernate.Cfg.Binder [] <> - Mapped property: Artist -> Artist, type: String
2005-06-17 19:54:43,812 [3480] DEBUG NHibernate.Cfg.Binder [] <> - Mapped property: Title -> Title, type: String
2005-06-17 19:54:43,828 [3480] DEBUG NHibernate.Cfg.Binder [] <> - Mapped property: Style -> Style, type: Style
2005-06-17 19:54:43,828 [3480] DEBUG NHibernate.Cfg.Binder [] <> - Mapped property: Tracks, type: ICollection
2005-06-17 19:54:43,828 [3480] INFO NHibernate.Cfg.Configuration [] <> - Found mapping documents in assembly: cddb.Track.Track.hbm.xml
2005-06-17 19:54:43,828 [3480] INFO NHibernate.Dialect.Dialect [] <> - Using dialect: NHibernate.Dialect.MsSql2000Dialect
2005-06-17 19:54:43,828 [3480] INFO NHibernate.Cfg.Binder [] <> - Mapping class: mtbsoftware.Track -> tblTrack
2005-06-17 19:54:43,828 [3480] DEBUG NHibernate.Cfg.Binder [] <> - Mapped property: Id -> Id, type: Int64
2005-06-17 19:54:43,828 [3480] DEBUG NHibernate.Cfg.Binder [] <> - Mapped property: Name -> Name, type: String
2005-06-17 19:54:43,828 [3480] DEBUG NHibernate.Cfg.Binder [] <> - Mapped property: Duration -> Duration, type: DateTime
2005-06-17 19:54:43,828 [3480] DEBUG NHibernate.Cfg.Binder [] <> - Mapped property: CD -> DiscId, type: CD
2005-06-17 19:54:43,921 [3480] INFO NHibernate.Cfg.Configuration [] <> - processing one-to-many association mappings
2005-06-17 19:54:43,937 [3480] DEBUG NHibernate.Cfg.Binder [] <> - Second pass for collection: mtbsoftware.Style.CDs
2005-06-17 19:54:43,937 [3480] INFO NHibernate.Cfg.Binder [] <> - mapping collection: mtbsoftware.Style.CDs -> tblCD
2005-06-17 19:54:43,937 [3480] DEBUG NHibernate.Cfg.Binder [] <> - Mapped collection key: Style, one-to-many: CD
2005-06-17 19:54:43,937 [3480] DEBUG NHibernate.Cfg.Binder [] <> - Second pass for collection: mtbsoftware.CD.Tracks
2005-06-17 19:54:43,937 [3480] INFO NHibernate.Cfg.Binder [] <> - mapping collection: mtbsoftware.CD.Tracks -> tblTrack
2005-06-17 19:54:43,937 [3480] DEBUG NHibernate.Cfg.Binder [] <> - Mapped collection key: DiscId, one-to-many: Track
2005-06-17 19:54:43,937 [3480] INFO NHibernate.Cfg.Configuration [] <> - processing one-to-one association property references
2005-06-17 19:54:43,937 [3480] INFO NHibernate.Cfg.Configuration [] <> - processing foreign key constraints
2005-06-17 19:54:43,937 [3480] DEBUG NHibernate.Cfg.Configuration [] <> - resolving reference to class: CD
2005-06-17 19:54:43,937 [3480] DEBUG NHibernate.Cfg.Configuration [] <> - resolving reference to class: Style
2005-06-17 19:54:43,953 [3480] INFO NHibernate.Dialect.Dialect [] <> - Using dialect: NHibernate.Dialect.MsSql2000Dialect
2005-06-17 19:54:43,953 [3480] INFO NHibernate.Cfg.SettingsFactory [] <> - use outer join fetching: True
2005-06-17 19:54:43,968 [3480] INFO NHibernate.Connection.ConnectionProviderFactory [] <> - Intitializing connection provider: NHibernate.Connection.DriverConnectionProvider
2005-06-17 19:54:43,968 [3480] INFO NHibernate.Connection.ConnectionProvider [] <> - Configuring ConnectionProvider
2005-06-17 19:54:43,968 [3480] INFO NHibernate.Cfg.SettingsFactory [] <> - echoing all SQL to stdout
2005-06-17 19:54:43,968 [3480] INFO NHibernate.Cfg.SettingsFactory [] <> - Query language substitutions:
2005-06-17 19:54:43,984 [3480] INFO NHibernate.Cfg.SettingsFactory [] <> - cache provider: NHibernate.Cache.HashtableCacheProvider
2005-06-17 19:54:43,984 [3480] INFO NHibernate.Cfg.Configuration [] <> - instantiating and configuring caches
2005-06-17 19:54:43,984 [3480] INFO NHibernate.Impl.SessionFactoryImpl [] <> - building session factory
2005-06-17 19:54:43,984 [3480] DEBUG NHibernate.Impl.SessionFactoryImpl [] <> - instantiating session factory with properties: hibernate.dialect=NHibernate.Dialect.MsSql2000Dialect;hibernate.show_sql=true;hibernate.connection.connection_string=***;hibernate.connection.provider=NHibernate.Connection.DriverConnectionProvider;hibernate.connection.driver_class=NHibernate.Driver.SqlClientDriver;
2005-06-17 19:54:44,562 [3480] DEBUG NHibernate.Impl.SessionFactoryObjectFactory [] <> - initializing class SessionFactoryObjectFactory
2005-06-17 19:54:44,562 [3480] DEBUG NHibernate.Impl.SessionFactoryObjectFactory [] <> - registered: 6cc5a80aaa824c9687bb856ce2db887d(unnamed)
2005-06-17 19:54:44,562 [3480] INFO NHibernate.Impl.SessionFactoryObjectFactory [] <> - no name configured
2005-06-17 19:54:44,562 [3480] DEBUG NHibernate.Impl.SessionFactoryImpl [] <> - Instantiated session factory
2005-06-17 19:54:44,875 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - opened session
2005-06-17 19:54:45,171 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - search: CD
2005-06-17 19:54:45,171 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - criteria: System.Collections.ArrayList
2005-06-17 19:54:45,203 [3480] DEBUG NHibernate.SqlCommand.SqlSelectBuilder [] <> - The initial capacity was set too low at: 12 for the SelectSqlBuilder that needed a capacity of: 14 for the table tblCD this
2005-06-17 19:54:45,203 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - flushing session
2005-06-17 19:54:45,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - Flushing entities and processing referenced collections
2005-06-17 19:54:45,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - Processing unreferenced collections
2005-06-17 19:54:45,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - Processed 0 unreachable collections.
2005-06-17 19:54:45,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - scheduling collection removes/(re)creates/updates
2005-06-17 19:54:45,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - Processed 0 for recreate (0), remove (0), and update (0)
2005-06-17 19:54:45,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - Flushed: 0 insertions, 0 updates, 0 deletions to 0 objects
2005-06-17 19:54:45,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
2005-06-17 19:54:45,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - dont need to execute flush
2005-06-17 19:54:45,250 [3480] DEBUG NHibernate.Impl.BatcherImpl [] <> - about to open: 0 open IDbCommands, 0 open DataReaders
2005-06-17 19:54:45,312 [3480] DEBUG NHibernate.Impl.BatcherImpl [] <> - Building an IDbCommand object for the SqlString: SELECT this.DiscId as DiscId1_, this.Title as Title1_, this.Style as Style1_, this.Artist as Artist1_, style1_.Name as Name0_ FROM tblCD this left outer join tblStyle style1_ on this.Style=style1_.Name WHERE (this.Style = :this.Style)
2005-06-17 19:54:45,343 [3480] DEBUG NHibernate.Engine.Cascades [] <> - unsaved-value strategy NULL
2005-06-17 19:54:45,343 [3480] DEBUG NHibernate.Type.NullableType [] <> - binding 'Rock' to parameter: 0
2005-06-17 19:54:45,343 [3480] INFO NHibernate.Loader.Loader [] <> - SELECT this.DiscId as DiscId1_, this.Title as Title1_, this.Style as Style1_, this.Artist as Artist1_, style1_.Name as Name0_ FROM tblCD this left outer join tblStyle style1_ on this.Style=style1_.Name WHERE (this.Style = @p0)
2005-06-17 19:54:45,343 [3480] INFO NHibernate.Impl.BatcherImpl [] <> - Preparing SELECT this.DiscId as DiscId1_, this.Title as Title1_, this.Style as Style1_, this.Artist as Artist1_, style1_.Name as Name0_ FROM tblCD this left outer join tblStyle style1_ on this.Style=style1_.Name WHERE (this.Style = @p0)
2005-06-17 19:54:45,359 [3480] DEBUG NHibernate.Connection.DriverConnectionProvider [] <> - Obtaining IDbConnection from Driver
2005-06-17 19:54:50,750 [3480] DEBUG NHibernate.Loader.Loader [] <> - processing result set
2005-06-17 19:54:50,890 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'Rock ' as column: Name0_
2005-06-17 19:54:50,906 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning '2 ' as column: DiscId1_
2005-06-17 19:54:50,906 [3480] DEBUG NHibernate.Loader.Loader [] <> - result row: Rock , 2
2005-06-17 19:54:50,906 [3480] DEBUG NHibernate.Loader.Loader [] <> - Initializing object from DataReader: Rock
2005-06-17 19:54:50,921 [3480] DEBUG NHibernate.Loader.Loader [] <> - Hydrating entity: mtbsoftware.Style#Rock
2005-06-17 19:54:50,968 [3480] DEBUG NHibernate.Loader.Loader [] <> - Initializing object from DataReader: 2
2005-06-17 19:54:50,968 [3480] DEBUG NHibernate.Loader.Loader [] <> - Hydrating entity: mtbsoftware.CD#2
2005-06-17 19:54:50,968 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'Abraxus ' as column: Title1_
2005-06-17 19:54:50,968 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'Rock ' as column: Style1_
2005-06-17 19:54:50,968 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'Santana ' as column: Artist1_
2005-06-17 19:54:51,000 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'Rock ' as column: Name0_
2005-06-17 19:54:51,000 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning '3 ' as column: DiscId1_
2005-06-17 19:54:51,000 [3480] DEBUG NHibernate.Loader.Loader [] <> - result row: Rock , 3
2005-06-17 19:54:51,000 [3480] DEBUG NHibernate.Loader.Loader [] <> - Initializing object from DataReader: 3
2005-06-17 19:54:51,000 [3480] DEBUG NHibernate.Loader.Loader [] <> - Hydrating entity: mtbsoftware.CD#3
2005-06-17 19:54:51,000 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'Some album ' as column: Title1_
2005-06-17 19:54:51,000 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'Rock ' as column: Style1_
2005-06-17 19:54:51,000 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'Gary Moore ' as column: Artist1_
2005-06-17 19:54:51,000 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'Rock ' as column: Name0_
2005-06-17 19:54:51,000 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'ABCDEF ' as column: DiscId1_
2005-06-17 19:54:51,000 [3480] DEBUG NHibernate.Loader.Loader [] <> - result row: Rock , ABCDEF
2005-06-17 19:54:51,000 [3480] DEBUG NHibernate.Loader.Loader [] <> - Initializing object from DataReader: ABCDEF
2005-06-17 19:54:51,000 [3480] DEBUG NHibernate.Loader.Loader [] <> - Hydrating entity: mtbsoftware.CD#ABCDEF
2005-06-17 19:54:51,000 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'lovehatetragedy ' as column: Title1_
2005-06-17 19:54:51,000 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'Rock ' as column: Style1_
2005-06-17 19:54:51,000 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'Papa Roach ' as column: Artist1_
2005-06-17 19:54:51,000 [3480] DEBUG NHibernate.Loader.Loader [] <> - done processing result set (3 rows)
2005-06-17 19:54:51,015 [3480] DEBUG NHibernate.Impl.BatcherImpl [] <> - done closing: 0 open IDbCommands, 0 open DataReaders
2005-06-17 19:54:51,015 [3480] DEBUG NHibernate.Loader.Loader [] <> - total objects hydrated: 4
2005-06-17 19:54:51,046 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - resolving associations for: [mtbsoftware.Style#Rock ]
2005-06-17 19:54:51,078 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - creating collection wrapper:[mtbsoftware.Style.CDs#Rock ]
2005-06-17 19:54:51,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - done materializing entity [mtbsoftware.Style#Rock ]
2005-06-17 19:54:51,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - resolving associations for: [mtbsoftware.CD#2 ]
2005-06-17 19:54:51,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - creating collection wrapper:[mtbsoftware.CD.Tracks#2 ]
2005-06-17 19:54:51,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - loading [Style#Rock ]
2005-06-17 19:54:51,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - attempting to resolve [Style#Rock ]
2005-06-17 19:54:51,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - resolved object in session cache [mtbsoftware.Style#Rock ]
2005-06-17 19:54:51,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - done materializing entity [mtbsoftware.CD#2 ]
2005-06-17 19:54:51,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - resolving associations for: [mtbsoftware.CD#3 ]
2005-06-17 19:54:51,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - creating collection wrapper:[mtbsoftware.CD.Tracks#3 ]
2005-06-17 19:54:51,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - loading [Style#Rock ]
2005-06-17 19:54:51,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - attempting to resolve [Style#Rock ]
2005-06-17 19:54:51,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - resolved object in session cache [mtbsoftware.Style#Rock ]
2005-06-17 19:54:51,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - done materializing entity [mtbsoftware.CD#3 ]
2005-06-17 19:54:51,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - resolving associations for: [mtbsoftware.CD#ABCDEF ]
2005-06-17 19:54:51,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - creating collection wrapper:[mtbsoftware.CD.Tracks#ABCDEF ]
2005-06-17 19:54:51,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - loading [Style#Rock ]
2005-06-17 19:54:51,234 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - attempting to resolve [Style#Rock ]
2005-06-17 19:54:51,250 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - resolved object in session cache [mtbsoftware.Style#Rock ]
2005-06-17 19:54:51,250 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - done materializing entity [mtbsoftware.CD#ABCDEF ]
2005-06-17 19:54:51,250 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - initializing non-lazy collections
2005-06-17 19:54:51,250 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - initializing collection [mtbsoftware.CD.Tracks#ABCDEF ]
2005-06-17 19:54:51,250 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - checking second-level cache
2005-06-17 19:54:51,250 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - collection not cached
2005-06-17 19:54:51,265 [3480] DEBUG NHibernate.Impl.BatcherImpl [] <> - about to open: 0 open IDbCommands, 0 open DataReaders
2005-06-17 19:54:51,265 [3480] DEBUG NHibernate.Impl.BatcherImpl [] <> - Building an IDbCommand object for the SqlString: SELECT tracks0_.DiscId as DiscId__, tracks0_.Id as Id__, tracks0_.Id as Id0_, tracks0_.Duration as Duration0_, tracks0_.Name as Name0_, tracks0_.DiscId as DiscId0_ FROM tblTrack tracks0_ WHERE tracks0_.DiscId = :tracks0_.DiscId
2005-06-17 19:54:51,265 [3480] DEBUG NHibernate.Type.NullableType [] <> - binding 'ABCDEF ' to parameter: 0
2005-06-17 19:54:51,265 [3480] INFO NHibernate.Loader.Loader [] <> - SELECT tracks0_.DiscId as DiscId__, tracks0_.Id as Id__, tracks0_.Id as Id0_, tracks0_.Duration as Duration0_, tracks0_.Name as Name0_, tracks0_.DiscId as DiscId0_ FROM tblTrack tracks0_ WHERE tracks0_.DiscId = @p0
2005-06-17 19:54:51,265 [3480] INFO NHibernate.Impl.BatcherImpl [] <> - Preparing SELECT tracks0_.DiscId as DiscId__, tracks0_.Id as Id__, tracks0_.Id as Id0_, tracks0_.Duration as Duration0_, tracks0_.Name as Name0_, tracks0_.DiscId as DiscId0_ FROM tblTrack tracks0_ WHERE tracks0_.DiscId = @p0
2005-06-17 19:54:51,265 [3480] DEBUG NHibernate.Loader.Loader [] <> - result set contains (possibly empty) collection: [mtbsoftware.CD.Tracks#ABCDEF ]
2005-06-17 19:54:51,265 [3480] INFO NHibernate.Impl.SessionImpl [] <> - uninitialized collection: initializing
2005-06-17 19:54:51,265 [3480] DEBUG NHibernate.Loader.Loader [] <> - processing result set
2005-06-17 19:54:51,390 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning '1' as column: Id0_
2005-06-17 19:54:51,390 [3480] DEBUG NHibernate.Loader.Loader [] <> - result row: 1
2005-06-17 19:54:51,390 [3480] DEBUG NHibernate.Loader.Loader [] <> - Initializing object from DataReader: 1
2005-06-17 19:54:51,390 [3480] DEBUG NHibernate.Loader.Loader [] <> - Hydrating entity: mtbsoftware.Track#1
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning '30/12/1899' as column: Duration0_
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'M-80 ' as column: Name0_
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'ABCDEF ' as column: DiscId0_
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'ABCDEF ' as column: DiscId__
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Loader.Loader [] <> - found row of collection: [mtbsoftware.CD.Tracks#ABCDEF ]
2005-06-17 19:54:51,406 [3480] INFO NHibernate.Impl.SessionImpl [] <> - reading row
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning '1' as column: Id__
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - loading [Track#1]
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - attempting to resolve [Track#1]
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - resolved object in session cache [mtbsoftware.Track#1]
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning '2' as column: Id0_
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Loader.Loader [] <> - result row: 2
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Loader.Loader [] <> - Initializing object from DataReader: 2
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Loader.Loader [] <> - Hydrating entity: mtbsoftware.Track#2
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning '30/12/1899' as column: Duration0_
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'Life is a bullet ' as column: Name0_
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'ABCDEF ' as column: DiscId0_
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'ABCDEF ' as column: DiscId__
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Loader.Loader [] <> - found row of collection: [mtbsoftware.CD.Tracks#ABCDEF ]
2005-06-17 19:54:51,406 [3480] INFO NHibernate.Impl.SessionImpl [] <> - reading row
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning '2' as column: Id__
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - loading [Track#2]
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - attempting to resolve [Track#2]
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - resolved object in session cache [mtbsoftware.Track#2]
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Loader.Loader [] <> - done processing result set (2 rows)
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Impl.BatcherImpl [] <> - done closing: 0 open IDbCommands, 0 open DataReaders
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Loader.Loader [] <> - total objects hydrated: 2
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - resolving associations for: [mtbsoftware.Track#1]
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - loading [CD#ABCDEF ]
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - attempting to resolve [CD#ABCDEF ]
2005-06-17 19:54:51,406 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - resolved object in session cache [mtbsoftware.CD#ABCDEF ]
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - done materializing entity [mtbsoftware.Track#1]
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - resolving associations for: [mtbsoftware.Track#2]
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - loading [CD#ABCDEF ]
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - attempting to resolve [CD#ABCDEF ]
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - resolved object in session cache [mtbsoftware.CD#ABCDEF ]
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - done materializing entity [mtbsoftware.Track#2]
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - 1 collections were found in result set
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - collection fully initialized: [mtbsoftware.CD.Tracks#ABCDEF ]
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - 1 collections initialized
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - collection initialized
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - initializing collection [mtbsoftware.CD.Tracks#3 ]
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - checking second-level cache
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - collection not cached
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.BatcherImpl [] <> - about to open: 0 open IDbCommands, 0 open DataReaders
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.BatcherImpl [] <> - Building an IDbCommand object for the SqlString: SELECT tracks0_.DiscId as DiscId__, tracks0_.Id as Id__, tracks0_.Id as Id0_, tracks0_.Duration as Duration0_, tracks0_.Name as Name0_, tracks0_.DiscId as DiscId0_ FROM tblTrack tracks0_ WHERE tracks0_.DiscId = :tracks0_.DiscId
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Type.NullableType [] <> - binding '3 ' to parameter: 0
2005-06-17 19:54:51,421 [3480] INFO NHibernate.Loader.Loader [] <> - SELECT tracks0_.DiscId as DiscId__, tracks0_.Id as Id__, tracks0_.Id as Id0_, tracks0_.Duration as Duration0_, tracks0_.Name as Name0_, tracks0_.DiscId as DiscId0_ FROM tblTrack tracks0_ WHERE tracks0_.DiscId = @p0
2005-06-17 19:54:51,421 [3480] INFO NHibernate.Impl.BatcherImpl [] <> - Preparing SELECT tracks0_.DiscId as DiscId__, tracks0_.Id as Id__, tracks0_.Id as Id0_, tracks0_.Duration as Duration0_, tracks0_.Name as Name0_, tracks0_.DiscId as DiscId0_ FROM tblTrack tracks0_ WHERE tracks0_.DiscId = @p0
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Loader.Loader [] <> - result set contains (possibly empty) collection: [mtbsoftware.CD.Tracks#3 ]
2005-06-17 19:54:51,421 [3480] INFO NHibernate.Impl.SessionImpl [] <> - uninitialized collection: initializing
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Loader.Loader [] <> - processing result set
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Loader.Loader [] <> - done processing result set (0 rows)
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.BatcherImpl [] <> - done closing: 0 open IDbCommands, 0 open DataReaders
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Loader.Loader [] <> - total objects hydrated: 0
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - 1 collections were found in result set
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - collection fully initialized: [mtbsoftware.CD.Tracks#3 ]
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - 1 collections initialized
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - collection initialized
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - initializing collection [mtbsoftware.CD.Tracks#2 ]
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - checking second-level cache
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - collection not cached
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.BatcherImpl [] <> - about to open: 0 open IDbCommands, 0 open DataReaders
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.BatcherImpl [] <> - Building an IDbCommand object for the SqlString: SELECT tracks0_.DiscId as DiscId__, tracks0_.Id as Id__, tracks0_.Id as Id0_, tracks0_.Duration as Duration0_, tracks0_.Name as Name0_, tracks0_.DiscId as DiscId0_ FROM tblTrack tracks0_ WHERE tracks0_.DiscId = :tracks0_.DiscId
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Type.NullableType [] <> - binding '2 ' to parameter: 0
2005-06-17 19:54:51,421 [3480] INFO NHibernate.Loader.Loader [] <> - SELECT tracks0_.DiscId as DiscId__, tracks0_.Id as Id__, tracks0_.Id as Id0_, tracks0_.Duration as Duration0_, tracks0_.Name as Name0_, tracks0_.DiscId as DiscId0_ FROM tblTrack tracks0_ WHERE tracks0_.DiscId = @p0
2005-06-17 19:54:51,421 [3480] INFO NHibernate.Impl.BatcherImpl [] <> - Preparing SELECT tracks0_.DiscId as DiscId__, tracks0_.Id as Id__, tracks0_.Id as Id0_, tracks0_.Duration as Duration0_, tracks0_.Name as Name0_, tracks0_.DiscId as DiscId0_ FROM tblTrack tracks0_ WHERE tracks0_.DiscId = @p0
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Loader.Loader [] <> - result set contains (possibly empty) collection: [mtbsoftware.CD.Tracks#2 ]
2005-06-17 19:54:51,421 [3480] INFO NHibernate.Impl.SessionImpl [] <> - uninitialized collection: initializing
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Loader.Loader [] <> - processing result set
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Loader.Loader [] <> - done processing result set (0 rows)
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.BatcherImpl [] <> - done closing: 0 open IDbCommands, 0 open DataReaders
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Loader.Loader [] <> - total objects hydrated: 0
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - 1 collections were found in result set
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - collection fully initialized: [mtbsoftware.CD.Tracks#2 ]
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - 1 collections initialized
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - collection initialized
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - initializing collection [mtbsoftware.Style.CDs#Rock ]
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - checking second-level cache
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - collection not cached
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.BatcherImpl [] <> - about to open: 0 open IDbCommands, 0 open DataReaders
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.BatcherImpl [] <> - Building an IDbCommand object for the SqlString: SELECT cds0_.Style as Style__, cds0_.DiscId as DiscId__, cds0_.DiscId as DiscId0_, cds0_.Title as Title0_, cds0_.Style as Style0_, cds0_.Artist as Artist0_ FROM tblCD cds0_ WHERE cds0_.Style = :cds0_.Style
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Type.NullableType [] <> - binding 'Rock ' to parameter: 0
2005-06-17 19:54:51,421 [3480] INFO NHibernate.Loader.Loader [] <> - SELECT cds0_.Style as Style__, cds0_.DiscId as DiscId__, cds0_.DiscId as DiscId0_, cds0_.Title as Title0_, cds0_.Style as Style0_, cds0_.Artist as Artist0_ FROM tblCD cds0_ WHERE cds0_.Style = @p0
2005-06-17 19:54:51,421 [3480] INFO NHibernate.Impl.BatcherImpl [] <> - Preparing SELECT cds0_.Style as Style__, cds0_.DiscId as DiscId__, cds0_.DiscId as DiscId0_, cds0_.Title as Title0_, cds0_.Style as Style0_, cds0_.Artist as Artist0_ FROM tblCD cds0_ WHERE cds0_.Style = @p0
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Loader.Loader [] <> - result set contains (possibly empty) collection: [mtbsoftware.Style.CDs#Rock ]
2005-06-17 19:54:51,421 [3480] INFO NHibernate.Impl.SessionImpl [] <> - uninitialized collection: initializing
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Loader.Loader [] <> - processing result set
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning '2 ' as column: DiscId0_
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Loader.Loader [] <> - result row: 2
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'Rock ' as column: Style__
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Loader.Loader [] <> - found row of collection: [mtbsoftware.Style.CDs#Rock ]
2005-06-17 19:54:51,421 [3480] INFO NHibernate.Impl.SessionImpl [] <> - reading row
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning '2 ' as column: DiscId__
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - loading [CD#2 ]
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - attempting to resolve [CD#2 ]
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - resolved object in session cache [mtbsoftware.CD#2 ]
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning '3 ' as column: DiscId0_
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Loader.Loader [] <> - result row: 3
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'Rock ' as column: Style__
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Loader.Loader [] <> - found row of collection: [mtbsoftware.Style.CDs#Rock ]
2005-06-17 19:54:51,421 [3480] INFO NHibernate.Impl.SessionImpl [] <> - reading row
2005-06-17 19:54:51,421 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning '3 ' as column: DiscId__
2005-06-17 19:54:51,437 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - loading [CD#3 ]
2005-06-17 19:54:51,437 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - attempting to resolve [CD#3 ]
2005-06-17 19:54:51,437 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - resolved object in session cache [mtbsoftware.CD#3 ]
2005-06-17 19:54:51,437 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'ABCDEF ' as column: DiscId0_
2005-06-17 19:54:51,437 [3480] DEBUG NHibernate.Loader.Loader [] <> - result row: ABCDEF
2005-06-17 19:54:51,437 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'Rock ' as column: Style__
2005-06-17 19:54:51,437 [3480] DEBUG NHibernate.Loader.Loader [] <> - found row of collection: [mtbsoftware.Style.CDs#Rock ]
2005-06-17 19:54:51,437 [3480] INFO NHibernate.Impl.SessionImpl [] <> - reading row
2005-06-17 19:54:51,437 [3480] DEBUG NHibernate.Type.NullableType [] <> - returning 'ABCDEF ' as column: DiscId__
2005-06-17 19:54:51,437 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - loading [CD#ABCDEF ]
2005-06-17 19:54:51,437 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - attempting to resolve [CD#ABCDEF ]
2005-06-17 19:54:51,437 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - resolved object in session cache [mtbsoftware.CD#ABCDEF ]
2005-06-17 19:54:51,437 [3480] DEBUG NHibernate.Loader.Loader [] <> - done processing result set (3 rows)
2005-06-17 19:54:51,437 [3480] DEBUG NHibernate.Impl.BatcherImpl [] <> - done closing: 0 open IDbCommands, 0 open DataReaders
2005-06-17 19:54:51,437 [3480] DEBUG NHibernate.Loader.Loader [] <> - total objects hydrated: 0
2005-06-17 19:54:51,437 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - 1 collections were found in result set
2005-06-17 19:54:51,437 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - collection fully initialized: [mtbsoftware.Style.CDs#Rock ]
2005-06-17 19:54:51,437 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - 1 collections initialized
2005-06-17 19:54:51,437 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - collection initialized
2005-06-17 19:54:54,406 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - closing session
2005-06-17 19:54:54,406 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - disconnecting session
2005-06-17 19:54:54,406 [3480] DEBUG NHibernate.Connection.ConnectionProvider [] <> - Closing connection
2005-06-17 19:54:54,406 [3480] DEBUG NHibernate.Impl.SessionImpl [] <> - transaction completion

I haven't included the simple style table previously, didn't want to overlad the original question with too much stuff :-)

It's here:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="mtbsoftware.Style, cddb" table="tblStyle">
<id name="Name" column="Name">
<generator class="assigned" />
</id>
<bag name="CDs" cascade="all" lazy="false" inverse="true">
<key column="Style" />
<one-to-many class="mtbsoftware.CD, cddb" />
</bag>
</class>
</hibernate-mapping>

Thanks for the info. re cascade="none" - I hadn't got this far as I'd been trying to get the relationships working, but much obliged, will check this out.


Top
  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.