Hibernate version:
3.2
So I have a bit of a design issue that I figured I would throw out here to see if any of you have done something similar. I'm sure you have, it's not a terribly unique problem, I am just having trouble wrapping my head around how it should work.
I am building an application where different customers can have different pricing models, sort of like oem vs retail. Each client will have different negotiated rates. For example if a client buys a unit of merchandise, 0-4 is the regular cost, 5-10 is a fixed cost, and 11-15 is a different cost. So if the product is $1 per unit, up to 5 they would be charged $1 each. After that, 5-10 units are a flat cost of $7 for all(not per unit). They can specify as many different levels as required in the contract. There are some clients who will have this "oem" type account and some that will pay only retail.
So in my database I have a table of definitions and a table of "models" that associate all the definitions together into something I associate to the user account. The problem is, how to associate the collection of definitions into a collection of units for that model. Right now, when I load up this data(there's only 5 unique units), I load it into a map indexed on the unit. The problem is that I can't figure out how to map the collection of charge definitions for that unit into the map.
Perhaps I am just going about this the wrong way. I'm sure someone out there has a better idea so if you think my approach is all wrong, I'd be happy to change the model to get this to work.
|