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

0

I have a modal form to record the register, when I insert the data it gives as if it were saved in the Eclipse console, but the same does not happen in the database

Message in the console as recording Ok.

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);
}
    
asked by anonymous 01.04.2015 / 04:55

1 answer

1

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

    
02.04.2015 / 02:45