Re: Help! Difficulty understanding DB -> Object mapping



frebe wrote:
I do need to record the title of the product with the line item, that
seems for sure price too.


Denormalizing data might only be a good idea in datawarehouse
solutions. In your transactional database, the schema must be
normalized.  The product title (and price) can be retrieved by a very
simple join.


with data that may change copied into the LineItem.


If you need history in your database, you change the schema to this:
OrderLineItem(Order_ID, Product_ID, ProductVersion,...)
Product(Product_ID, ....)
ProductVersion(ProductVersion, title, price, ....)

Copying all product data into every order line would cause you a data
bloat.

I see your point here, but orders may be volatile - you may want to change a description or some other data per customer per order - maybe a customized version of a product. You don't want to add a new product for every small one-off change.


Also, if you basically move everything to ProductVersion, you might as well consolidate the versions into one table, no?

PRODUCT:    Product_ID, Product_Version, Title, Price
ORDER_ITEM: Order_ID, Product_ID, Product_Version

Mike

It seems that from the application, it is necessary to load the

Product

object from somewhere


From the database, direct (using ADO) or indirect.


This seems like too many queries...


What is the problem with this? Queries is a good way to fetch the data
you want for the current context.


To view Order contents at the UI, have a different structure to
bring back the necessary data to be viewed, be that a resultset or
other information object?


Using resultsets is the simpliest solution, but it is not type-safe and
error-prone (column names are types as strings). The domain object
solution, will force you to write many find- and load-methods, unless
you use a competent O/R mapper.


I am using .NET - could you recommend somehting?


No, I am using java. But I have heard that ADO is more capable than
JDBC, so I would probably use ADO directly.

Fredrik Bertilsson
http://butler.sourceforge.net

.



Relevant Pages

  • ieShoes.com Shop nike air jordan air force 1 dunk sb bape sta shoes
    ... Main Menu Search Basket Content Checkout Customer Service Order ... Air Force I ... Air Jordan 11-22 ... NOTE:All the list price include the shipping charge.thank you! ...
    (comp.lang.python)
  • ieShoes.com Shop nike air jordan air force 1 dunk sb bape sta shoes
    ... Main Menu Search Basket Content Checkout Customer Service Order ... Air Force I ... Air Jordan 11-22 ... NOTE:All the list price include the shipping charge.thank you! ...
    (rec.bicycles.misc)
  • ieShoes.com Shop nike air jordan air force 1 dunk sb bape sta shoes
    ... Main Menu Search Basket Content Checkout Customer Service Order ... Air Force I ... Air Jordan 11-22 ... NOTE:All the list price include the shipping charge.thank you! ...
    (rec.running)
  • Re: Personal edition as advertising
    ... The key is, given that, how do you make money? ... the price to maximize buyers and ulitmate product. ... Do you sell lemonaide for 25 cents a cup or $1000 a cup? ... of lemonaide that cater to different customer ranges. ...
    (borland.public.delphi.non-technical)
  • Re: guitar ctr vs. Sam @$$
    ... customer service skills, ... stores in the past, haven't been isolated incidents. ... at our store they don't even bother to put price ... They have these stupid-cheap sales from time to ...
    (rec.music.makers.percussion)