Login Skip Navigation LinksWilsonORMapper > Forums Search
Demo Version Demo Version
Download and try for yourself a fully working demo version, including sample apps and documentation.  The only limitation is that the demo version only works inside the debugger.

PayPal Subscribe
Get It All for $50 USD:
WebPortal, ORMapper,
Source Code, All Updates
PayPal

User Login User Login
Log In
 
 
Reset Password

Wilson ORMapper Forums Wilson ORMapper Forums : General Support : JOIN Scenario?

Date Post
8/22/2007 2:32:51 PM In a Many-To-One relationship, is it possible to load all parent objects using a JOIN?  Similar to NHibernate's "fetch=join" attribute?

For example, if I have a large list of orders I need to display in a grid.  One of the columns is the order's customer's name.  So everytime I call Order.Customer.Name it makes a SQL call to load the Customer object.  With lazy="false", it pre-loads them (which is expected) but it still makes a seperate SQL call for each Customer object.

Is there anyway to tell the mapper to use a join instead?  I realize I could use the Lookup field, but I dont think I should have to create lookup fields for all the Customer's properties.  And dont really want to. (CustomerName, CustomerAddress, CustomerPhone etc). Or is that only way?

Travis
8/22/2007 7:38:07 PM

Other than the Lookup for individual properties, you'll have to manually manage associations if you need more control.  For instance, I do a lot of caching for objects that I know are mostly static, and so instead of using the ORMapper to pull associations, I use the ORMapper once for each type and then cache the results -- then my objects use my cache to get their associations.  Its not a hard concept, or even hard code, but it is custom code nonetheless.  NHibernate's certainly has more built-in options, although in my experience my manual solutions, which are still populated with my ORMapper, far outperform the pre-built solution that are overly generic.

Thanks, Paul Wilson