Do java DTO's typically contain lists? Or are they normally just a flat structure? I have searched around and not been able to find any examples of DTO's that contain lists.
Say I have a constructor like this:
public WidgetDTO(String name, String type, List<Tag> tagList) {
this.name = name;
this.type = type;
this.tagList = tagList;
}
and in my repository I have this:
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<WidgetDTO> query = criteriaBuilder.createQuery(WidgetDTO.class);
Root<Widget> root = query.from(Widget.class);
can I build this with just a join, as I do when pulling the entity from the db?
Join<Widget, Tag> tagJoin = root.join(Widget_.tagList);
or do I need to do a subquery? Or should I skip lists altogether? When trying to do a join as above I was getting an error similar to :
Unable to locate appropriate constructor on class [com.mypackage.Widget]
thanks