Travis (and everyone else),
Thanks. It is not really a case of it not being the same thing, all of these tables are just materialized views of data collected elsewhere.
Say for example, I have a series of training classes, and have tables which are materialized views of the numbers of attendees and their grades in the training. One attribute is the raw number of attendees who have a grade of 0-24%, the next is 25-49%, the next is 50-74% and the next is 75+. Then I have another attribute containing the number of attendees in total. I've got similar tables that view the data in similar ways based on which training course, which location for the course, and which teacher for the course.
So the tables simply give the raw numbers for each of the attributes. The java class for each wants to be able to calculate percentages based on those numbers (e.g. 27% of the total attendees were 75+) and a component for each wants to display the numbers and the calculated result. I also want to have the component be able to sort based on the columns and the calculated percentages.
So there is not a lot of calculating, but there are some very basic calculations. I could do this in lots of different ways, it just seemed to me that an abstract superclass would be the best way. I don't particularly care about the primary key as these tables are being used read only, and I just need to view the data. This would seem more straightforward in Cocoa, but I can try the interface route.
I'll give that a try.
Andrew Date: Thu, 6 Aug 2009 17:49:04 -0400 From: Travis Britt <email@hidden> Subject: Re: Multiple EO classes inheriting from one abstract superclass? To: WebObjects-Dev List <email@hidden> Message-ID: <email@hidden">email@hidden> Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes
On Aug 6, 2009, at 4:10 PM, Andrew R. Kinnie wrote:
I have four tables in a database, which are materialized views from
an oracle db. All four share 12 columns, which are basically
numerical values.
I have 4 components which display repetitions based on these four
tables. I have these inheriting from one abstract superclass
containing the calculations on the 12 values.
The problem is, Entity Modeler wants me to have a primary key for
the abstract eo superclass, but the 4 subclasses have different
primary keys representing different foreign keys from their source
tables. Some of these keys are multiple foreign keys from multiple
source tables (i.e. the eo is essentially a join)
I suggest these entities have some of the same things, but aren't the same thing. At least so far as EOF is concerned. :)
Any ideas? It there a way to do this? Or do I need to write the
code 4 times in both the component and the eos?
What code are you writing four times? You mentioned you have code that does the computation in a common component class? Depending on what the code is there are lots of ways to avoid the duplication. You could define an object that does all the work and then call on it from each of the four EOs, so the code that does real work only exists once... You could have each of those EOs implement an interface for those columns. Then you'd write your component to work with objects that implement that interface...
tb
|