Re: Doubling Up
Re: Doubling Up
- Subject: Re: Doubling Up
- From: Chuck Hill <email@hidden>
- Date: Wed, 5 Jan 2005 13:08:15 -0800
Hi Nathan,
On Jan 4, 2005, at 9:40 PM, Nathan Hampton wrote:
I'm grafting a web ordering interface onto a legacy system that uses a
SQL Server database on the back end. The way the project is working
out, I only have to interface with the database, which is making my
life a whole lot easier. Unfortunately, "easier" is a relative term,
so I'd love some input on how to handle these.......
1) Right up front, let me tell you that the existing database is a bit
bizarre. I didn't design it; I just have to work with it. In this
database are two tables containing item information. Both have
exactly the same attributes, and are referenced interchangeably from
other tables. (Did I mention that there are no foreign key
constraints to manage the relationships? Grrrrrr....)
What is the difference between the two? Is the information duplicates,
or just split into two tables for some other reason?
What I'm not sure of is how I should model these tables and their
relationships. Is this a place to use inheritance? Horizontal
inheritance seems to be closest to what I want, so would I create a
superclass which has two subclasses with identical attributes?
Alternatively, should I try to fool EOF into thinking that they're
really one table by creating a view in the database that is a union of
the two tables? If I follow this approach, how much of a load will I
be adding to the database server?
Inheritance might be a solution, I'm still puzzling over the why. If
we know that it may be easier to recommend a path.
If it helps, I only have to read from these tables, not write to them.
(I may also need to add duplicates of tables I have to write to, such
as the InvoiceHeaderHistory table, which contains historical data from
the InvoiceHeader table that I need to write to, but that would be
later.)
There is a section in Practical WebObjects on copying EOs. You can
probably modify that to create this history.
2) This project will work with four identical databases, each
representing one of the company's four locations. I'd like to use the
same EOModel for all four, since they have the same structure, but I
need to figure out how to connect to the appropriate database on a
per-session basis. I think I can get away with making the user
specify which of the four locations they use (they're in four
different major metropolitan areas, so users are unlikely to get
confused about which one to select), but how would I use that
information to tell the application which database to use? Or do I
need to have four (identical) EOModels, and have the user input select
the appropriate model, and, therefore, the relevant database? Or is
there another way I haven't thought of?
If you do this all in one app, then you will need to manage a pool of
four EOF stacks. You will need to manually create each EC using new
EOEditingContext(EOObjectStoreCoordinator). You will need to set
these stacks up manually, set the connection dictionary when each is
created, and manage using the right one for a particular session.
An alternative worth considering is to run an instance of your app for
each city, rather than having one instance handle all of them. That
would be a lot easier to setup. You would just create new applications
in JavaMonitor (same .woa but a different app name in JM) and pass in
the JDBC URL as a launch arg.
Chuck
--
Practical WebObjects - a book for intermediate WebObjects developers
who want to increase their overall knowledge of WebObjects, or those
who are trying to solve specific application development problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >Doubling Up (From: Nathan Hampton <email@hidden>) |