Re: Help! Difficulty understanding DB -> Object mapping
- From: usenet.news.account@xxxxxxxxx
- Date: 8 May 2005 06:26:29 -0700
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.
>
This sounds like a reasonable idea. Are you putting the main
changeable details in ProductVersion (it seems that way but want to
check I am reading properly).
> > 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.
>
The issue with queries which I thought you were referencing, was that I
will need to keep going back to the database to load up all of the
different objects referenced by the Order/OrderLineItem. From my
computer science course I have learnt that many journeys to the
database is a performance issue. Would you agree?
> > 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.
>
Yes, this is what I have.
> > 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 thankyou.
> Fredrik Bertilsson
> http://butler.sourceforge.net
.
- Follow-Ups:
- References:
- Help! Difficulty understanding DB -> Object mapping
- From: usenet . news . account
- Re: Help! Difficulty understanding DB -> Object mapping
- From: frebe
- Re: Help! Difficulty understanding DB -> Object mapping
- From: usenet . news . account
- Re: Help! Difficulty understanding DB -> Object mapping
- From: frebe
- Help! Difficulty understanding DB -> Object mapping
- Prev by Date: Re: Help! Difficulty understanding DB -> Object mapping
- Next by Date: Re: Help! Difficulty understanding DB -> Object mapping
- Previous by thread: Re: Help! Difficulty understanding DB -> Object mapping
- Next by thread: Re: Help! Difficulty understanding DB -> Object mapping
- Index(es):
Relevant Pages
|