0
When making an insertion in the Postgree bank I have as a response a very strange error:
2019-11-22 17:06:30.310 ERROR 15212 --- [nio-8080-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper : Nenhum resultado foi retornado pela consulta.
And the worst is that in mine Query
at no time did I make a SELECT
Inside my Repository
have defined:
@Repository
public interface ConteudoRepository extends AbstractRepository<Conteudo, Long> {
@Query(value = "INSERT INTO conteudo (" +
"NM_LOGIN," +
"DT_CADASTRO," +
"CONTEUDO," +
"CD_SECAO," +
"NU_EDICAO," +
"DT_PUBLICACAO" +
")" +
" VALUES (" +
":nm_login," +
"NOW()," +
":conteudo," +
":cd_secao," +
":num_edicao_diario," +
":dt_publicacao)", nativeQuery = true)
Conteudo insertInDb(@Param("nm_login") String nm_login,
@Param("conteudo") String conteudo,
@Param("cd_secao") Integer cd_secao,
@Param("num_edicao_diario") Integer num_edicao_diario,
@Param("dt_publicacao") Date dt_publicacao);
}
And with the Entity
:
@Data
@Entity
@EqualsAndHashCode(callSuper = false)
@Table(name = "conteudo", schema = "public")
public class Conteudo extends AbstractEntity {
public Conteudo(){}
public Conteudo(String nm_login, String conteudo, Integer cd_secao, Integer nu_edicao, Date dt_publicacao, char processado, Integer nr_ordem){
this.nm_login = nm_login;
this.conteudo = conteudo;
this.cd_secao = cd_secao;
this.nu_edicao = nu_edicao;
this.dt_publicacao = dt_publicacao;
this.processado = processado;
this.nr_ordem = nr_ordem;
}
@Id
@Column(name = "NUM_SEQ", nullable = false)
private int num_seq;
@Column(name = "NU_EDICAO")
private int nu_edicao;
@Column(name = "NM_LOGIN", nullable = false)
private String nm_login;
@Temporal(TemporalType.DATE)
@Column(name = "DT_CADASTRO")
private Date dt_cadastro;
@Column(name = "CONTEUDO", nullable = false)
private String conteudo;
@Column(name = "CHAVE")
private String chave;
@Column(name = "RETORNO")
private String retorno;
@Column(name = "PROCESSADO", nullable = false)
private char processado;
@Column(name = "CONFIRMACAO")
private String confirmacao;
@Column(name = "DS_COMANDO_IMPORTACAO")
private String ds_comando_importacao;
@Column(name = "TP_COMANDO")
private char[] tp_comando = new char[1];
@Temporal(TemporalType.DATE)
@Column(name = "DT_PUBLICACAO")
private Date dt_publicacao;
@Temporal(TemporalType.DATE)
@Column(name = "DT_REFERENCIA")
private Date dt_referencia;
@Column(name = "NR_ORDEM", nullable = false)
private int nr_ordem;
@Column(name = "ID_IMPORTACAO")
private int id_importacao;
@Column(name = "DS_COMPOSICAO")
private String ds_composicao;
@Column(name = "CD_SECAO", nullable = false)
private Integer cd_secao;
@Column(name = "OBSERVACAO")
private String observacao;
@Column(name = "TP_PUBLICACAO")
private int tp_publicacao;
@Column(name = "NU_PROCESSO")
private String nu_processo;
@Column(name = "QTD_PUBLICACAO")
private int qtd_publicacao;
@Column(name = "CD_SETOR")
private int cd_setor;
}
I have tested several solutions, but none provided the solution of the problem.
Remembering that I have full access to this table with the user I am using.
I’ll check, thank you!
– Matheus Ribeiro
Did it work friend? If so, could you accept my answer as correct? Thank you very much.
– Fabiano Salles