java - Hibernate composite keys with abstract class -


is possible have employee table composit primary key (personid,departmentname) keeping

the person's class @id annotation , keeping abstract class.

public abstract class person {     @id     @generatedvalue     @column(name = "person_id")     private long personid;      @column(name = "firstname")     private string firstname;       // getter , setter methods,  }    @entity @table(name="employee") @primarykeyjoincolumn(name="person_id") public class employee extends person {      @column(name="joining_date")     private date joiningdate;      @column(name="department_name")     private string departmentname;      public employee() {     }      public employee(string firstname, string lastname, string departmentname, date joiningdate) {          super(firstname, lastname);          this.departmentname = departmentname;         this.joiningdate = joiningdate;     }      // getter , setter methods,  } 


Comments

Popular posts from this blog

How to access named pipes using JavaScript in Firefox add-on? -

multithreading - OPAL (Open Phone Abstraction Library) Transport not terminated when reattaching thread? -

node.js - req param returns an empty array -