I have two entity classes - A and B. The template of the code is as follows:
class A extends class B {
// ...
}
@Entity
@Table("OPERATION")
@DiscriminatorValue()
@Access()
class B {
// ...
}
Class B has a schema defination in the .sql file. Class A does not have any schema defination.
My question is, doesn't class A need to have a schema definition in the .sql file as well, in order for it to be mapped to the relational database? I am confused on this and cannot understand how the mapping is taking place.
To use a more concrete example, I have the following two classes Operation and OperationAmend with their code as follows :
@Entity
@DiscriminatorValue()
@Access()
class OperationAmend extends Operation {
//some functions here for amending an operation
}
@Entity
@Table("OPERATION")
@DiscriminatorValue()
@Access()
class Operation {
//some functions here for the operation.
}
SQL Schema :
CREATE TABLE OPERATION {
OperationId INT;
Name VARCHAR(20);
}
How can the OperationAmend class be saved even when it has no schema?