Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Storing Java Objects in Oracle
Create your "stations" and "neighbors" tables. The "stations" table has
all the information about the stations and the "neighbors" table has only
two station id's. Another way is if you know the maximum number of
neighbors any station can ever have then use the columns n1, n2, ... in
the "stations table to hold the id's of the neighboring stations.
-- Ken Denny http://www.kendenny.com/ Be nice to your kids. They'll choose your nursing home. vrw <linux4m32000_at_netscape.net> wrote in news:u9ud7a1h7uogbe_at_corp.supernews.com:Received on Mon Mar 25 2002 - 12:20:05 CST
> Hi everyone,
>
> I am encountering the following problem: I have a programmed a subway
> route-optimization program, and I have decided to store the information
> about different citys' subway grids in an Oracle database. The problem
> is this: in my solution, inherently, stations and lines are
> 'recursive', in other words I have layed out my Java code in such a way
> that each station knows about its immediate neighbours, and each line
> knows about all the lines it intersects with. That leads to quite a
> problem: I can either store all the stations (and lines) twice, calling
> one table 'station', and the other 'neighbour', or sth. similar, and
> then give each neighbour a foreign key of which station it is a
> neighbour of. But I think's thats a horrible way of doing things (not
> to mention it needlessly doubles info, thus violating 3rd normal
> form...) so I think the way to go is to create all my stations,
> (including their 'adjacentStations' array list data member) in Java,
> connect to the DB, and then store those stations in the db. Any
> comments ?
>
> Thanks for your advice,
>
> Regards,
>
> Volkmar