This is my DTO class
package com.example.University.dto;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
public class FileDbDTO {
private String name;
private String type;
private Long size;
private String teacherName;
private byte[] data;
public FileDbDTO(String name, String type, Long size) {
this.name = name;
this.type = type;
this.size = size;
}
}
The feald teacherName refers to the column name of table Teacher. But when I write "techer" instead of it, шn didn't work. Each time I have to find by selection which field name will output the data I need from the linked tables.
Is it possible to somehow find out the right field name without having to run applications every time?
I use postgre DB
This is my teacher class
package com.example.University.model.people;
import com.example.University.model.FileDb;
import com.example.University.model.Task;
import com.example.University.model.subjects.Subject;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.ToString;
import javax.persistence.*;
import java.util.Set;
@Entity
public class Teacher extends Person {
private String subject;
@ManyToMany(mappedBy = "teacherSet")
@JsonIgnore
@ToString.Exclude
private Set<Subject> subjectSet;
@OneToMany(mappedBy = "teacher")
@JsonIgnore
@ToString.Exclude
private Set<Task> tasks;
@OneToMany(mappedBy = "teacher")
@JsonIgnore
@ToString.Exclude
private Set<FileDb> fileDbs;
public Teacher(String name, Integer age, String universityName, String subject, String type) {
super(name, age, universityName, type);
this.subject = subject;
}
public Teacher() {
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
@Override
public String toString() {
return super.toString() +
"Teacher{" +
", subject='" + subject + '\'' +
'}';
}
public void enrollTask(Task task) {
tasks.add(task);
}
}