Distinct - nÃo consigo mostrar o resultado do distinct na tela

3 respostas
priscilabrasil2007

1- DAO:

DetachedCriteria criteria = DetachedCriteria.forClass(QuebraSigilo.class, "s");
 criteria.setProjection(Projections.distinct(Projections.property("s.caso")));

2- O RESULTADO NA TELA DO CONSOLE;

select
      distinct top 50 this_.CASO as y0_
  from
      OFICIO_CLIENTE_QUEBRA_SIGILO this_

3- BEAN:

public String gerarArquivo()
    {
    	//pesquisasr
    	caso = "";
    	Set<QuebraSigilo> lista = new HashSet<QuebraSigilo>(quebraSigiloDao.pesquisarArquivo());
     	listaOficiosEmitidos = new ArrayList<QuebraSigilo>(lista);
    	System.out.println("---------------------Lista oficio emitidos: " + listaOficiosEmitidos.toString());
    	return "gerarArquivo";	
    }

4- JSF:

<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a="http://richfaces.org/a4j" 
	xmlns:r="http://richfaces.org/rich"
	xmlns:s="http://jboss.com/products/seam/taglib"
	template="/templates/corebancario.xhtml">

	<ui:define name="csuName">
		<h:outputText value="#{messages['vocEstAqui']}" styleClass="voce" />
		<h:outputText value=" " />
		<h:outputText value="#{messages['oficio']}" styleClass="nomeMenu" />
		<h:outputText value=" " />
		<h:outputText value="#{messages['gerarArquivo']}" styleClass="subMenu" />
	</ui:define>

	<ui:define name="body">

		<script>
         function getRightTop(ref) {
           var position = new Object();
           position.top = 0; //ref.offsetTop;
           position.left =0; // ref.offsetLeft+ref.clientWidth+6;
           return position;
         }
        </script>

		<s:div>
			<h:form id="form" prependId="false">
			<a:keepAlive beanName="quebraSigiloBean" />
				<br />
				<h:panelGrid columns="2" cellspacing="0" width="18%" style="margin-left:30%;"
					styleClass="formularioDetalhar">

					<h:outputLabel	value="#{messages['numero.caso']}" 	styleClass="rich-text-general" />
					<h:inputText id="ano" value="#{quebraSigiloBean.caso}" maxlength="4"
						style="text-align:rigth;width:135px;" styleClass="rich-input"
						label="#{messages['caso']}"
				   />		
				</h:panelGrid>
				
				<r:spacer height="15" />
				
				<br />
				
				<h:panelGrid id="pnlSearch1" columns="1" cellspacing="0"
					width="100%" columnClasses="field-label-form,field-edit-form">
					<h:panelGroup id="pnlButtons" layout="block"
						styleClass="linhaInterna">
						<div align="center">
							<h:commandButton
							value="Pesquisar" actionListener="#{quebraSigiloBean.pesquisarArquivo}"
							styleClass="rich-buttonGerencial"/>
							
							<h:commandButton
							value="Abandonar" action="#{quebraSigiloBean.abandonar}"
							styleClass="rich-buttonGerencial"/>
						</div>
					</h:panelGroup>

				<h:panelGroup id="pnlTabelaCliente" layout="block" style="width:100%;">
					<r:dataTable id="tableOficio" var="row"
						headerClass="rich-table-subheader"  value="#{listaOficiosEmitidos}" 
						rows="10" width="100%" rowClasses="row-odd,row-even"
						rowKeyVar="linha">
						<f:facet name="footer">
							 <r:datascroller id="tblScroller_cliente" immediate="true"
								maxPages="10" status="_stsLoad1" reRender="tableOficio"
								for="tableOficio"/>
    					</f:facet>
    			
    					<r:column style="text-align: center">	
						<f:facet name="header">
								<h:outputText value="#{messages['caso']}" />
						</f:facet>
						<h:outputText value="#{row.caso}" />
					 </r:column>
    					
    				<r:column style="text-align: center">	
						<f:facet name="header">
								<h:outputText value="#{messages['contaQuebra']}" />
						</f:facet>
							<h:commandLink styleClass="rich-link" action="#{quebraSigiloBean.excluirOrigemDestino}">	
									<h:graphicImage value="/img/arquivo.jpg" alt="#{messages['alterar']}" 
									style=" margin-right: 10px" styleClass="semBorda"/>
							</h:commandLink>
					</r:column>	
				  															
				</r:dataTable>
				</h:panelGroup>
			</h:panelGrid>
			</h:form>
		</s:div>
	</ui:define>
</ui:composition>

5-ERRO:

09:33:01,140 INFO  [STDOUT] ---------------------Lista oficio emitidos: [654654, 787, 1012454, 477897, 65465, 141547, 14, 456456, 12, 20, 4545, 564564, 30, 545454, 89789, 45454, 5454]
09:33:01,187 WARN  [AjaxRendererUtils] AJAX Status component not found for AjaxComponent with id tblScroller_cliente
09:33:01,203 SEVERE [viewhandler] Error Rendering View[/view/quebraSigilo/gerarArquivo.xhtml]
javax.faces.FacesException: javax.el.PropertyNotFoundException: /view/quebraSigilo/gerarArquivo.xhtml @78,43 value="#{row.caso}": Property 'caso' not found on type java.lang.String
        at javax.faces.component.UIOutput.getValue(UIOutput.java:187)

onde estou errando?

3 Respostas

T

No seu MB (quebraSigiloBean) existe a propriedade caso. Tem metodos get e set para essa propriedade ?

priscilabrasil2007

tested

priscilabrasil2007

te

Criado 14 de março de 2012
Ultima resposta 14 de mar. de 2012
Respostas 3
Participantes 2