title: How do you implement inheritance with tables that have multi-column/composite primary keys (JPA 1.0 @IdClass)?
body: <p>Given the following tables:</p>
  
  <pre><code>CREATE TABLE Employees
  (
    first_name VARCHAR(50) NOT NULL,
    last_name VARCHAR(50) NOT NULL,
    birth_date DATE NOT NULL,
    PRIMARY KEY (first_name, last_name)
  );
  
  CREATE TABLE Managers
  (
    first_name VARCHAR(50) NOT NULL,
    last_name VARCHAR(50) NOT NULL,
    salary INTEGER NOT NULL,
    total_bonus INTEGER NULL,
    PRIMARY KEY (first_name, last_name),
    CONSTRAINT managers_employees_fk FOREIGN KEY (first_name, last_name) REFERENCES Employees (first_name, last_name)
  );
  
  CREATE TABLE Workers
  (
    first_name VARCHAR(50) NOT NULL,
    last_name VARCHAR(50) NOT NULL,
    wage INTEGER NOT NULL,
    PRIMARY KEY (first_name, last_name),
    CONSTRAINT workers_employees_fk FOREIGN KEY (first_name, last_name) REFERENCES Employees (first_name, last_name)
  );
  </code></pre>
  
  <p>how would you implement the entity and composite primary key classes using JPA 1.0 @IdClass annotations?</p>
  
  <p>Sub questions arising are:</p>
  
  <ol>
  <li>Do sub classes define their own ID classes?</li>
  <li>If so, do they inherit from the super class' ID class?</li>
  <li>Do sub classes get @IdClass annotations?</li>
  </ol>
  
  <p>Note the question is intentionally naive. I'd like to see the class declarations, properties with field access annotations without getters and setters will probably suffice.</p>
  
  <p>Thanks</p>