我有两个DTOs
:
RedCatDTO {
color: string,someSpecialAttribute: string
}
和
BlueCatDTO {
color: string,someSpecialAttribute: string
}
如何设计数据库表并存储这两个DTOs
?
我有两个DTOs
:
RedCatDTO {
color: string,someSpecialAttribute: string
}
和
BlueCatDTO {
color: string,someSpecialAttribute: string
}
如何设计数据库表并存储这两个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;
}
或者您可以说
Cat blueCat = new Cat();
blueCat.setColor("blue");
请注意,这是粗略的代码,因此您需要研究如何创建表等。