ORM is the anachronism of : Object Relational Mapping. ORM is a technique to map classes to relational data base. NH is a persistent layer based on ORM. Even if we are supporting some legacy scenario and even if NH is very flexible and injectable does not mean that NH should solve the problem of map an untouchable domain with untouchable RDBMS especially when the RDBMS was not designed following ORM.
You can't have two Eliot Ness (one is more than enough); NH is not the only one Al Capone. http://fabiomaulo.blogspot.com/2009/06/database-eliot-ness-of-it.html 2009/12/1 RedHotSLy <[email protected]> > Hi Fabio, > > Yes, "in the order they are loaded" is what I'd do. > > Can you guide me on the best way to do it? Should I create a class > that implements IUserCollectionType and that derives from the default > NH array class? What is the name of that NH class? Can you provide any > hint on what method I'll have to override to provide the index value? > > BTW, I don't think my usage context is strange. In fact I think it is > a good use case for an ORM in the context of an existing app. I think > O/R mapping is something that should be transparent to the things that > are being mapped. Do you agree? The class library already exists and > works fine. I want it to remain persistence ignorant and not be > affected by the introduction of NH. Same thing for the DB, in theory I > could have it changed. But I don't want to add an index column to all > the child tables just to please my ORM (introduction of an ORM should > not require changes to the database). > > So if NH does not support that out-of-the-box, I'm willing to invest > some time to make it work because I think this is the best solution > (in that context); it keeps things clean and well decoupled. > > Thanks again for your help. > > > - Sly > > > > On Nov 30, 6:22 pm, Fabio Maulo <[email protected]> wrote: > > possible... by "random" you mean "in the order they are loaded". > > > > btw there is something strange... you can't change the class, you can't > > change the DB but... you can use NH... WOW!! > > When you have all work done please write a post about it because this is > a > > very interesting example application of NH. > > > > 2009/11/30 RedHotSLy <[email protected]> > > > > > > > > > LOL, That's a good one! > > > Let's say a choose to keep my job... > > > > > Do you think it it possible to make the <array> mapping work by > > > creating a IUserCollectionType that shims the gap by providing random > > > index values? > > > > > On Nov 30, 12:49 pm, Fabio Maulo <[email protected]> wrote: > > > > Try to find another job, where you are working there are too much > > > > restrictions. > > > > > > 2009/11/30 RedHotSLy <[email protected]> > > > > > > > Hi Fabio, > > > > > > > I'm sorry, my first post was ambiguous. I have a existing library > that > > > > > I cannot change AND a database that I cannot change. I need a way > to > > > > > map them without changing either of them. Therefore, I cannot add a > > > > > private field as you suggested. > > > > > > > Regards, > > > > > > > - Sly > > > > > > > On Nov 29, 7:13 am, Fabio Maulo <[email protected]> wrote: > > > > > > use a <bag> mapped to a private field and expose the array in > your > > > class. > > > > > > An array has index, a bag is an unordered, not indexed, "bolsa de > > > gatos" > > > > > > > > 2009/11/28 RedHotSLy <[email protected]> > > > > > > > > > Hi, > > > > > > > > > I have an existing POCO class library that uses arrays for > children > > > > > > > collections and I have an exiting database that I cannot > change. > > > > > > > > > I want to use the <array> mapping but it requires an <index> > > > element. > > > > > > > In my existing database, the children tables do not have index > > > > > > > columns. For instance, when the Invoices of a Customer are > loaded, > > > I > > > > > > > don't expect them to be at any specific position in the array. > > > > > > > > > I think I need a IUserCollectionType to solve this problem. I'd > > > need a > > > > > > > collection type that satisfies the <array> mapping; a type > similar > > > to > > > > > > > the nhibernate array type but that produces index value > on-the-fly > > > > > > > (and that wouldn't try to save it to the database). > > > > > > > > > Has this been done before? Is there any chance I could get the > > > source > > > > > > > code for such a collection type? This is my first nhibernate > > > project > > > > > > > so I'd rather not have to understand the inner workings at this > > > point. > > > > > > > It'd be great if I could just get started and later learn how > to > > > > > > > extend nhibernate. > > > > > > > > > Thanks a lot > > > > > > > > > - Sly > > > > > > > > > By the way, I have posted a very similar question on SO and > this is > > > > > > > where I was told about IUserCollectionType. > > > > > > > See > > > > >http://stackoverflow.com/questions/1746414/how-configure-nhibernate-t. > > > > > .. > > > > > > > > > -- > > > > > > > > > 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%[email protected]<nhusers%[email protected]> > > > > > > > > > <nhusers%[email protected]<nhusers%[email protected]> > <nhusers%[email protected]<nhusers%[email protected]> > > > > > <nhusers%[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]> > <nhusers%[email protected]<nhusers%[email protected]> > > > > > <nhusers%[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]> > <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. > > > -- 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]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
