Olá pessoal, tenho uma aplicação que estava tudo certo funcionando blza, só que a anotação estava @SessionScoped e eu tive que alterar para @RequestScoped, depois disso minhas exclusões pararam de funcionar. Uso primefaces, hibernate, spring security e banco postegres. @ManagedBean(name = "uploadNotasManagedBean")
@RequestScoped
public class UploadNotasManagedBean {
private CadastroDeDataPagamento cdp = new CadastroDeDataPagamento();
public void excluir(DataPagamento dtPag) throws FalhaDeExclusaoException, FalhaDePesquisaException{
cdp.excluir(dtPag);
}
public void excluir(DataPagamento dataPagamento)
throws FalhaDeExclusaoException, FalhaDePesquisaException {
try {
dataPagamentoDao.getSession().beginTransaction();
dataPagamentoDao.delete(dataPagamento);
dataPagamentoDao.getSession().getTransaction().commit();
} catch (DAOException e) {
e.printStackTrace();
throw new FalhaDeExclusaoException();
}
}
public void delete(T entity) throws DAOException {
getSession().delete(entity);
}
<h:form id="cons">
<p:dataTable id="tabela" value="#{uploadNotasManagedBean.datasPag}"
var="dataPag" emptyMessage="Não há registro há exibir!"
paginator="true" rows="10"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="5,10,15">
<f:facet name="header">
Listagem de pagamentos importados, pagos e simulados.
</f:facet>
<p:column headerText="Excluir">
<p:commandLink action="#{uploadNotasManagedBean.excluir(dataPag)}"
update="@(form:last)" value="Excluir" />
</p:column>
<p:column headerText="Data de Pagamento">
<h:outputText value="#{dataPag.dataPagamento}" />
</p:column>