I just had a chat to my PM with our b2b site architecture, and he gave out a drafted decision as follows:
Quote:
Some Domain object, such as MarketInfo and Product (or even as CompanyProfile, TrustProfile, Management, Certificates...), should be kind of independent to the main domain object Company. And if needed, just add a column named companyid in its database table and hook up to company table with a foreign key.
But, it will cause a design problem:
According to our legacy database design, which remains no surrogate keys and auto increment triggers, and if I need to get products from company, I must get a “comid” from http session, and then
Code:
List products = productManager.getProductsByCompanyId(comId);
I always feel like using hibernate in this way is so amateur,although I do be a rookie:), since I will never use object association at all.
However,based on my knowledge to hibernate, my ideal design is:
changing the schema of database table which needed to related to company table,adding the surrogate keys, oracle sequences and triggers as auto increment,adding a column named company_skid and hooking up to company table with a foreign key. Then configuring with some sorts of set or map in my *.hbm.xml, finally I can do like this:
Code:
List products = companyManager.getCompany(comId).getProducts();
On the other hand, if there are many associations to Company, it will be quite a heavy domain object,so now it seems my first solution is also valuable to my design.
Well, I am in such a dilemma. Any experienced designer can give me a trade-off?
Any help or insight into this problem would be much appreciated!