I have two DTOs
:
RedCatDTO {
color: string,
someSpecialAttribute: string
}
and
BlueCatDTO {
color: string,
someSpecialAttribute: string
}
How can I design a Database table and store these two DTOs
?
SQL
CREATE TABLE CAT {
color varchar(24),
attribute varchar(24),
}
JAVA
public class Cat{
String color;
String attribute;
}
public class BlueCat extends Cat{
String color = blue;
}
Or you can just say
Cat blueCat = new Cat();
blueCat.setColor("blue");
Please note this is rough code, so you will need to investigate how to create table, etc.