I Need to insert one record in my DB, but in some cases I need to pass the ID but when I insert my id manually the spring-boot don`t save with this ID, the spring-boot got a new from sequence
this is my Entity
@Entity
@Table(schema = "db_cartorio_inteligente", name = "tb_movimentacao")
@SequenceGenerator(sequenceName="db_cartorio_inteligente.tb_movimentacao_seq", name = "tb_movimentacao_seq")
public class TbMovimentacao {
@Id
@GeneratedValue(strategy= GenerationType.SEQUENCE, generator = "tb_movimentacao_seq")
private Long idMovimentacao;
and this is my code to save:
TbMovimentacao novaMovimentacao = new TbMovimentacao();
novaMovimentacao.setIdMovimentacao(12323);
this.movimentacaoRepository.save(novaMovimentacao);
instead save with id 12323 he got the next from my sequence