steckemetz, I think you misunderstood the question. I have a pattern with two tables & one class, not two classes and one table.
Again, using Person as a simple example:
Code:
TABLE PERSON
ID FIRST_NAME LAST_NAME
223 HERBIE HANCOCK
2345 CHICK COREA
TABLE PERSON_ARCHIVE
ID FIRST_NAME LAST_NAME
1234 MILES DAVIS
1155 JOHN COLTRANE
...
and one class:
Code:
public class Person {
private long id;
private String firstName;
private String lastName;
...
}
The goal is to have an elegant solution to select Person from both tables at once.
Christoph, yes, your solution seems to be the only one available in Hibernate right now - use empty sublasses for the two tables
http://www.hibernate.org/hib_docs/v3/reference/en/html/inheritance.html
so Person becomes abstract, and I would have two empty subclasses:
e.g.
PersonCurrent that maps to PERSON
PersonArchive that maps to PERSON_ARCHIVE
and then I can select from Person and get both. Still, as you say, that's a lot of extra classes and mess to solve this problem. Currently, I have no solution, as we are just now introducing the ARCHIVE tables.