Having a one-to-one with nhibernate objects

So after getting my latest project up and running I wanted to look behind the scenes, and to do so I took a deep look into the sql-statement which are being executed against the database – yes I know, this might seem a little geeky.

So I figured, that I have two objects A and B which have a one-to-one association. And since I declared B to be lazy loaded from A I expected only to hit the ‘A’-table when fetching all ‘A’s from the DB. But I was far off – A and B where both completely scanned 🙁

After some quick google-ing I figured – this is just the way a one-to-one association works; there is no lazy loading! 🙁

OK, so I might switch to use something else instead …

Leave a Comment.