Java JDL为DTO中的OneToMany相关实体生成了getter
我正在使用JDL(JHipster 5.8.1)定义我的域模型,其中包含DTO选项:Java JDL为DTO中的OneToMany相关实体生成了getter,java,jhipster,jdl,Java,Jhipster,Jdl,我正在使用JDL(JHipster 5.8.1)定义我的域模型,其中包含DTO选项: entity Event { title String maxlength(128) required, bannerUrl String maxlength(256) required, summary String maxlength(256)
entity Event {
title String maxlength(128) required,
bannerUrl String maxlength(256) required,
summary String maxlength(256) required
}
entity Tag {
name String maxlength(64) required
}
entity Team {
title String maxlength(128) required,
description TextBlob
}
relationship ManyToMany {
Event{tags} to Tag{events}
}
relationship OneToMany {
Event{teams} to Team{event required}
}
relationship ManyToOne {
Event{city} to City{events}
}
dto * with mapstruct
我试图定义包含多个可重用标记和多个团队的事件。该接口将使API生成复合JSON,其中包含所有标记和Requirested事件中的所有团队(以避免REST中的N+1问题)
我希望得到标记事件和团队事件之间的双向关系。对于许多关系来说,这是事实:我在EventDTO中看到了getter For TagDTO。但是对于OneToMany(也有很多OneToMany),我在Event中没有看到任何getter,也没有在团队中看到eventId getter:
public class EventDTO implements Serializable {
private Long id;
@NotNull
@Size(max = 128)
private String title;
@NotNull
@Size(max = 256)
private String bannerUrl;
@NotNull
@Size(max = 256)
private String summary;
private Long cityId;
private Set<TagDTO> tags = new HashSet<>();
public类eventd实现可序列化{
私人长id;
@NotNull
@尺寸(最大值=128)
私有字符串标题;
@NotNull
@尺寸(最大值=256)
私人字符串横幅;
@NotNull
@尺寸(最大值=256)
私有字符串摘要;
私人长城;
private Set tags=new HashSet();
如果ackereload=true,则不使用mapstruct生成的代码将生成所有子实体的预期JSON,但这种方法可能会导致安全问题
是否可以更正我的JDL以生成类似childEntity的DTO而不是类似childId的DTO