As Raul said, it is not mandatory. Probably I was not clear enough. I told you three ways to map it, as list, as many-to-one, OR both.
On 7 Aug., 08:38, Sachin <[email protected]> wrote: > Hi Stefan > Thanks for the reply. > Actually my only concern is if in table A i define mapping as OneTo > Many but in table B I dont need objects of class A then would I still > have to define Many to One there. > > I had tried doing that and it doesn't create any problems but just to > make sure if it is mandatory. > > On Aug 7, 11:30 am, Stefan Steinegger <[email protected]> > wrote: > > > What exactly is the question? If you have a 1:M relation between two > > tables, you can map it differently. > > > Lets say Table A 1=>m Table B, mapped to classes A and B. > > > - Map it as a collection (list / bag / set / map etc.) of class A > > - Map it as a reference (many-to-one) in class B > > - Map it as both, by defining the collection as inverse=true > > > You have to decide how your class model should look like. This is > > actually a question of object oriented design. After you finished > > modeling you domain classes, you know how it needs to be mapped using > > NH. > > > On 7 Aug., 08:18, Sachin <[email protected]> wrote: > > > > If I have a relation say 1:M between two tables so is it mandatory > > > that I specify it in mappings of both of entities, as I have > > > implemented that if I specify bag/list in mapping of class in which I > > > require to have it specifies it and I need not specify M:1 in other > > > class as I do not require it in other class. > > > > Thanks- Hide quoted text - > > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
