Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail From: "Lew" Subject: Re: Java Toplink Essentia Message-ID: X-Comment-To: comp.lang.java.databases Newsgroups: comp.lang.java.databases In-Reply-To: References: Content-Type: text/plain; charset=IBM437 Content-Transfer-Encoding: 8bit X-Gateway: time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92] Lines: 46 Date: Wed, 27 Apr 2011 15:22:33 GMT NNTP-Posting-Host: 96.60.20.240 X-Complaints-To: news@tds.net X-Trace: newsreading01.news.tds.net 1303917753 96.60.20.240 (Wed, 27 Apr 2011 10:22:33 CDT) NNTP-Posting-Date: Wed, 27 Apr 2011 10:22:33 CDT Organization: TDS.net Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.databases:239 To: comp.lang.java.databases nicola wrote: >> In my db there are some tables like >> >> TABLE1_2006 (ID, CODE, VOLUME) >> TABLE2_2007 (ID, CODE, VOLUME) >> TABLE3_2008 (ID, CODE, VOLUME) Martin Gregorie wrote: > Declare a view over all the tables and enquire on that. > > But, why on earth use multiple tables? They don't do anything that a > single table with a YEAR column couldn't do while managing to make at > least one task more difficult as you've just demonstrated. I feel suspicion when I read about inherited tables in a DBMS, such as in Postgres. At first blush the OP's situation seemed to me like an inherited-table scenario. I felt about as I might encountering an escaped specimen from Dr. Moreau's island. I used to feel that way about automated object-relational mapping (ORM) packages, but JPA alleviates that. There is a dichotomy between the world view of object-oriented programming and that of relational database architecture. Inherited tables seem out of place to me - object-oriented monstrosities in a data world. Multiple identical tables are like that also - if the data structures are the same and have the same interpretation, that argues for a single logical table. Martin's suggestion is spot on, and completely harmonious with the data-world outlook. I don't know of a term analogous to "normal form" (as in "third normal form") for excessive splitting of tables into many tables; all the normal forms have to do with insufficient splitting. Advances in the database world occur in how to structure data - relations, normal forms, star schemae, foreign keys, these are the building blocks of DBMSes as classes and objects are of O-O programming. How one structures data for a database is different from how one structures objects for a program. -- Lew --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24