My recommendation is that you try the default (lazy) first, and then start optimizing as needed. When you do, keep in mind eager fetching is not the only alternative. There's also caching and batch-size; you should understand all of them and see which one fits best each particular case.
Diego On Tue, Mar 30, 2010 at 12:08, Visar Uruqi <[email protected]> wrote: > Thank you very much for your reply, I agree with you that it is better > to transform it to an entity, I just wanted to ask you about this > issue > now in this case I will use lazy false for the first link one-to-many > and olso > the second link one-to-many, > how do you setup the depth of the object graph, for object retrieval? > Because in this case I need booth entity's loaded. > What's the strategy here for performance? > > In CakePHP you have this depth variable, I was wondering if you do > have it also in Nhibernate? > > Visar > > On Mar 30, 4:49 pm, Fabio Maulo <[email protected]> wrote: > > No. > > Because, I prefer <idbag> for many-to-many and when the relation will > have > > properties then I transform it to an entity > > > > btw > > <map name="Majors" cascade="all" table="MAJOR"> > > <key column="STUDENT_ID" /> > > <map-key-many-to-many column="SUBJECT_ID" class="Subject" /> > > <composite-element class="Major"> > > <property name="Note" /> > > </composite-element> > > </map> > > > > 2010/3/30 Visar Uruqi <[email protected]> > > > > > > > > > > > > > Thank you Fabio, this sounds very interesting, do you have any example > > > how to use this map-key-many-to-many a link or something. > > > > > visar > > > > > On Mar 30, 3:54 pm, Fabio Maulo <[email protected]> wrote: > > > > Map (Dictionary) with map-key-many-to-many and a component > > > > (composite-element) as value. > > > > > > 2010/3/30 Visar Uruqi <[email protected]> > > > > > > > OK I got the Idea, but suppose that middle table is not a entity, > > > > > suppose it is just a > > > > > middle table for many-to-many relationship, how would you handle it > in > > > > > a XML mapping file? > > > > > > > Visar > > > > > Thank you for your replies > > > > > > > On Mar 30, 1:49 pm, Kim Johansson <[email protected] > > > > > > > wrote: > > > > > > That's not a many-many relation... That's two one-many relations. > The > > > > > middle table needs to represented as an entity. > > > > > > > > Med vänliga hälsningar, > > > > > > Kim Johansson > > > > > > Industritorget Sweden AB > > > > > > Söndrumsvägen 29 > > > > > > 302 39 Halmstad > > > > > > tel: 035 - 260 32 00 > > > > > > fax: 035 - 12 24 83 > > > > > > epost: [email protected] > > > > > > webb:http://www.industritorget.se > > > > > > > > -----Original Message----- > > > > > > From: [email protected] [mailto:[email protected]] > On > > > > > Behalf Of Visar Uruqi > > > > > > Sent: den 30 mars 2010 12:40 > > > > > > To: nhusers > > > > > > Subject: [nhusers] Many to Many with lots of properties in the > middle > > > > > table > > > > > > > > This is the hardest thing I believe in NHibernate, > > > > > > The many to many relationship when the middle table has > properties > > > > > > beside the primary keys. Help me to map this example: > > > > > > > > Here in this link you will find an image of the schema that I > want to > > > > > > map, its 3 tables just for illustrationhttp:// > > > > > treshja.com/files/hotel.png > > > > > > > > how do you map this in Nhibernate using XML (not ActiveRecord)? > > > > > > > > Visar > > > > > > > > P.S. Thank you for your contribution, without you I would not be > able > > > > > > to use Nhibernate > > > > > > > > -- > > > > > > 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]<nhusers%[email protected]> > <nhusers%[email protected]<nhusers%[email protected]>> > > > <nhusers%[email protected]<nhusers%[email protected]> > <nhusers%252bunsubscr...@googlegroup s.com>> > > > > > . > > > > > > For more options, visit this group athttp:// > > > > > groups.google.com/group/nhusers?hl=en. > > > > > > > -- > > > > > 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]<nhusers%[email protected]> > <nhusers%[email protected]<nhusers%[email protected]>> > > > <nhusers%[email protected]<nhusers%[email protected]> > <nhusers%252bunsubscr...@googlegroup s.com>> > > > > > . > > > > > For more options, visit this group at > > > > >http://groups.google.com/group/nhusers?hl=en. > > > > > > -- > > > > 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]<nhusers%[email protected]> > <nhusers%[email protected]<nhusers%[email protected]>> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/nhusers?hl=en. > > > > -- > > 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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- 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.
