问题描述
我是Micronaut的新手,并且已经按照文档设置了REST应用程序,但是我无法列出很多简单的列表。启动应用程序时,一切看起来正常,数据库表正在正常生成,并且终端返回可分页的实体,但是对于许多关系,它不返回嵌套的列表。
@Entity
@Table(name = "unidade")
public class Unidade implements Serializable {
private static final long serialVersionID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@NotNull
private String nome;
@NotNull
private String cnpj;
private String storage;
private String telefone;
@Email
private String email;
private boolean ativo;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "empresa_id")
private Empresa empresa;
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "unidade_produto",joinColumns = @JoinColumn(name = "unidade_id"),inverseJoinColumns = @JoinColumn(name = "produto_id"))
private List<Produto> produtos;
}
@Entity
@Table(name = "produto")
public class Produto implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@NotNull
private String nome;
@ManyToMany(mappedBy = "produtos")
@JsonIgnore
private List<Unidade> unidades;
}
POST请求:
{
"nome": "Testando","cnpj": "000.000.000/0000-01","storage": "new","telefone": "0000-0000","email": "teste@gmail.com","ativo": true,"empresa": {
"id": 1
},"produtos": [
{
"id": 1
}
],"horario": {
"id": 1
}
}
嵌套实体没有回报。有人可以帮我解决这个问题吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)