Do not write to the database and the console appears as recorded

Asked

Viewed 330 times

0

I have a form inside the modal to record registration, when I insert the data it is as if it were recorded in the Eclipse console, but the same does not happen in the database

Message on console as Ok from recording.

Hibernate: 
select
    empresa0_.id as id1_0_,
    empresa0_.cnpj as cnpj2_0_,
    empresa0_.data_fundacao as data_fun3_0_,
    empresa0_.nome_fantasia as nome_fan4_0_,
    empresa0_.razao_social as razao_so5_0_,
    empresa0_.tipo as tipo6_0_ 
from
    Empresa empresa0_


<p:commandButton id="salvar-button" value="Salvar" 
                    action="#{gestaoEmpresasBean.salvar}"
                    process="empresa-dialog" update="empresa-table"
                    oncomplete="PF('edicaoEmpresaDialog').hide()" />

@Inject
private Empresas empresas;

@Inject
private CadastroEmpresaService cadastroEmpresa;

@Inject
private FacesMessages messages;

private List<Empresa> todasEmpresas;
private Empresa empresaEdicao = new Empresa();

public void prepararNovoCadastro() {
    empresaEdicao = new Empresa();
}

public void salvar() {
    cadastroEmpresa.salvar(empresaEdicao);
    consultar();

    messages.info("Empresa salva com sucesso!");
}

public void consultar() {
    todasEmpresas = empresas.todas();
}

public List<Empresa> getTodasEmpresas() {
    return todasEmpresas;
}

public TipoEmpresa[] getTiposEmpresas() {
    return TipoEmpresa.values();
}

public Empresa getEmpresaEdicao() {
    return empresaEdicao;
}

public void setEmpresaEdicao(Empresa empresaEdicao) {
    this.empresaEdicao = empresaEdicao;
}

Service

@Transactional
public void salvar(Empresa empresa) {
    empresas.guardar(empresa);
}
  • Is giving commit after entering, changing and deleting your bank information? How far do I know auto commit is false.

  • This log only shows that the record was retrieved from the database, it does not show that it was persisted. How about you show the bean code (gestationBean companies.save.)?

  • Would this error below be from messages.properties in the wrong place? Caused by: java.util.Missingresourceexception: Can’t find Bundle for base name com.algaworks.Erp.Messages, locale pt_BR

1 answer

1


People I managed to solve, it was configuration error of messages.properties that was in the wrong folder, also lacked persistence.xml inside the META-INF folder although I had already created automatic by eclipse, I did manual and it worked. Hug.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.