Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!transit3.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail From: "Martin Gregorie" 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: 48 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:238 To: comp.lang.java.databases On Wed, 10 Sep 2008 01:23:48 -0700, 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) > > They are equal but have diffferent name. In fact these tables are > created > every year (as you can see). > In this sense they use the same entity > > public class MyEntity implements Serializable { > private static final long serialVersionUID = 1L; @Id > @Column(name = "ID", nullable = false) private Integer id; > @Column(name = "CODE") > private String code; > @Column(name = "VOUME") > private String volume; > > ... > ... > ... > } > > I need to obtain different list of entities relative to all tables in > the same database; > can I change table name of my entity at runtime ? > > 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. -- martin@ | Martin Gregorie gregorie. | Essex, UK org | --- * 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