Need advice on how to show for insert/update all attributes of different entities on same screen

Hello,
I hope to get some advice as I have been researching but can’t find an answer. I am new to JPA so all these concepts are new to me but having fun learning them.

I have a Person entity which holds common information for Employee and Student, such as government ID number, name, date of birth etc.

Employee and Student will have specific information for their type BUT I want to create Screens where all attributes are shown on the same page and not by an entity picker for the subclasses.
so
ID:
Name:
Date of Birth:
.
.
EMPLOYEE OR STUDENT info
(all on same screen but saved to their different Tables)

What’s the recommended and most appropriate way to achieve this?
I weas looking at Parent - Child, Mappersuperclasses and Inheritance but I am not sure which way to go on jmix.

Thanks in advance

Am I right that the Employee and Student the related entities (many-to-one associations) to Person? Or are they subclasses of Person?

They are subclasses
I need them to inherit common attributes from Person such as firstname lastname date of birth ans then have Student and Employee have their own attributes.
I want an edit screen to show all attributes from both entities and not an entity picker

Thanks for answering

I would suggest creating separate edit screens for Employee and Student. Below is an example of possible implementation.

Person.java

@JmixEntity
@Table(name = "PERSON")
@Entity
@DiscriminatorColumn(name = "DTYPE", discriminatorType = DiscriminatorType.STRING)
@Inheritance(strategy = InheritanceType.JOINED)
public class Person {
    @JmixGeneratedValue
    @Column(name = "ID", nullable = false)
    @Id
    private UUID id;

    @Column(name = "VERSION", nullable = false)
    @Version
    private Integer version;

    @InstanceName
    @Column(name = "FIRST_NAME")
    private String firstName;

    @Column(name = "LAST_NAME")
    private String lastName;

Employee.java

@JmixEntity
@Table(name = "EMPLOYEE")
@Entity
@PrimaryKeyJoinColumn(name = "ID")
public class Employee extends Person {
    @Column(name = "EMPLOYEE_INFO")
    private String employeeInfo;

Student.java

@JmixEntity
@Table(name = "STUDENT")
@Entity
@PrimaryKeyJoinColumn(name = "ID")
public class Student extends Person {
    @Column(name = "STUDENT_INFO")
    private String studentInfo;

In UI, create a browse screen for Person entity and separate editors for Employee and Student.

In the Person browse, configure separate actions and buttons for creating Employee and Student:

<groupTable id="personsTable"
            width="100%"
            dataContainer="personsDc">
    <actions>
        <action id="createEmployee" type="create" caption="Create employee">
            <properties>
                <property name="screenId" value="Employee.edit"/>
            </properties>
        </action>
        <action id="createStudent" type="create" caption="Create student">
            <properties>
                <property name="screenId" value="Student.edit"/>
            </properties>
        </action>
        <action id="edit" type="edit"/>
        <action id="remove" type="remove"/>
    </actions>
    <columns>
        <column id="firstName"/>
        <column id="lastName"/>
    </columns>
    <simplePagination/>
    <buttonsPanel id="buttonsPanel"
                  alwaysVisible="true">
        <button id="createEmployeeBtn" action="personsTable.createEmployee"/>
        <button id="createStudentBtn" action="personsTable.createStudent"/>
        <button id="editBtn" action="personsTable.edit"/>
        <button id="removeBtn" action="personsTable.remove"/>
    </buttonsPanel>
</groupTable>

The actions should create corresponding types, it’s done in controller:

@UiController("Person.browse")
@UiDescriptor("person-browse.xml")
@LookupComponent("personsTable")
public class PersonBrowse extends StandardLookup<Person> {

    @Autowired
    private Metadata metadata;

    @Install(to = "personsTable.createEmployee", subject = "newEntitySupplier")
    private Person personsTableCreateEmployeeNewEntitySupplier() {
        return metadata.create(Employee.class);
    }

    @Install(to = "personsTable.createStudent", subject = "newEntitySupplier")
    private Person personsTableCreateStudentNewEntitySupplier() {
        return metadata.create(Student.class);
    }
}

The edit action opens the corresponding editor depending on the selected entity type.

The demo project is attached:
demo.zip (95.3 KB)

Thank you Konstantine!
Very valuable info.