Q: J2EE, Entity Bean - User1 extends User I've created a new Entity Bean, called User.
I would like to extend it, making some new Entity Beans called User1 (and User2, User3, and so on.. which represent the user type/group).
User1 has the same attributes as User (id, type, username, password, name, surname), and some others (like email, phoneNumber which the generic User doesn't have).
I would like all the new added attributes on User1 to be stored in a different table in a logic-like project:
USER(id, username, password, type, name, surname);
USER1(userId, email, phoneNumber);
That means USER1 will be a joined table between USER and USER1 on id=userId.
Does it make any sense?
This is my User Entity Bean code.
package com.entity;

import java.io.Serializable;
import javax.persistence.*;

@Entity
@DiscriminatorColumn(name="type")
public class User implements Serializable {

    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private int id;
    private String username;
    private String password; 
    private String type;
    private String name;
    private String surname;



    public User(String username, String password, String name, String surname) {
        super();
        this.setUsername(username);
        this.setPassword(password);
        this.setName(name);
        this.setSurname(surname);
    }

    public User() {
        super();
    }  

    ...
    getter&setter methods here
    ...

}


A: I've found out a solution, using the annotation @Inheritance(strategy=InheritanceType.JONED)
For mixed strategy:
http://forums.oracle.com/forums/thread.jspa?threadID=1030022
