I have a question about DTO class representation. I have two tables on my database, where one has two foreign keys on another one, for example:
book(id, author_name, author_age)
author(name, age, telephone)
where book author_name and author_age are foreign keys on author name and age.
Generally what's the best way to implement this situation on a DTO class? Inside Book DTO, it's better to do something like:
public class Book {
private String id;
private Author author;
}
or something like
public class Book {
private String id;
private String author_name;
private int author_age;
}
?
Aucun commentaire:
Enregistrer un commentaire