I am creating a Todo app in Spring Boot and I need to create two tables: Task
and Todo
(Todo
extends Task
).
In Task
table is a field called description
and I would like to prevent that column to be created in Todo
table.
How can I do it?
Task(parent):
package com.example.todo.model;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Task {
@Id
private long id;
private String name;
private String description;
}
Todo(child):
package com.example.todo.model;
import javax.persistence.Entity;
import javax.persistence.Transient;
@Entity
public class Todo extends Task {
private boolean isChecked;
}