Entity hold data which mapped to data from persistent storage. Usually this is DB.
You can hold ids:
class Book {
private String title;
public String getTitleId() { return title; }
private Long publisherId; // <== **it is**!
public Long getPublisherId() { return publisherId; }
private List<Long> authorIds;
public List<Long> getAuthorIds() { return authorIds; }
}
or resolved entities:
class Book {
private String title;
public String getTitleId() { return title; }
private Publisher publisher; // <== **it is**!
public Publisher getPublisher() { return publisher; }
private List<Author> authors;
public List<Author> getAuthors() { return authors; }
}
If you use ORM like Hibernate working with resolved entities is simple as ORM do *join*s with related entities for you for free.
But if you concern on performance or want to use DB features to move logic from Java to SQL with manual SQL queries then entities with ids win (they faster and it is annoying to join each related entities manually)!
So I decide to maintain two type of entities: with ids and with resolved related entities to hold this knowledge in data type (in type name).
So I start googling to get best suffixes for class names but can't find appropriated keywords. Please tell me how to name of methodology/tecnichue to hold ids vs related entities in entity!