Rendered of primefaces giving error when retrieving entity boolean

1

Does anyone know why rendered graphic image is giving error?

<p:dataGrid columns="3" value="#{projetistaBean.listaDeProjetistas}" var="projetista" styleClass="ui-datagrid"  >

                            <h:commandLink>
                                <f:ajax render=":formProjetista:projetistaSelecionado" event="click" listener="#{projetistaBean.selecionarProjetistaAtual()}" />
                                <h:panelGrid columns="1" style="border: none; width: 160px; text-align: center; "  >
                                    <p:graphicImage value="/temp/#{projetista.id}.png" cache="false" width="75" height="75" />
                                    <h:panelGroup>
                                        <h:graphicImage value="resources/imagens/membroR3ePequeno.png" rendered="#{projetista.pertenceMembroR3e}"  />
                                        <h:graphicImage value="resources/imagens/membroOIAPequeno.png" rendered="#{projetista.pertenceMembroOIA}" style="margin-left: 4px;"/>
                                        <h:graphicImage value="resources/imagens/membroAntacPequeno.png" rendered="#{projetista.pertenceMembroAntac}" style="margin-left: 4px;"/>
                                        <h:graphicImage value="resources/imagens/ServicoConsultoriaPequeno.png" rendered="#{projetista.pertenceConsultor}" style="margin-left: 4px;"/>
                                        <h:graphicImage value="resources/imagens/possuiEtiquetaAPequeno.png" rendered="#{projetista.pertenceEtiquetaA}" style="margin-left: 4px;"/>
                                        <h:graphicImage value="resources/imagens/possuiEtiquetaBPequeno.pmg"  style="margin-left: 4px;" rendered="#{projetista.mostrarEtiquetaB}" />
                                    </h:panelGroup>
                                    <h:outputText value="#{projetista.nome}"/> 
                                </h:panelGrid>
                            </h:commandLink>

                        </p:dataGrid>

Here is the entity code I use to fetch the boolean for rendering:

@javax.persistence.Entity
@Table(name = "projetista")
public class Projetista extends com.labcon.r3e.entity.Entity{

    @Id
    @Column(name = "id", nullable = false)
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Integer id;

    @Column(name = "nome", nullable = false)
    private String nome;

    @Column(name = "cidade", nullable = false)
    private String cidade;

    @Column(name = "email", nullable = false)
    private String email;

    @Column(name = "instituicao" , nullable = false)
    private String instituicao;

    @Column(name = "membro_r3e" , nullable = false)
    private Integer membro_r3e;

    @Column(name = "membro_antac" , nullable = false)
    private Integer membro_antac;

    @Column(name = "membro_oia" , nullable = false)
    private Integer membro_oia;

    @Column(name = "consultor" , nullable = false)
    private Integer consultor;

    @Column(name = "possui_projeto_a", nullable = false)
    private Integer possui_projeto_a;

    @Column(name = "possui_projeto_b" , nullable = false)
    private Integer possui_projeto_b;


    @Lob
    @Basic(fetch= FetchType.LAZY)
    private byte[] imagem;

    public Projetista() {

    }

    public boolean getPertenceMembroR3e(){
        return this.membro_r3e == 1;
    }

    public boolean getPertenceMembroAntac(){
        return this.membro_antac == 1;
    }

    public boolean getPertenceMembroOIA(){
        return this.membro_oia == 1;
    }

    public boolean getPertenceConsultor(){
        return this.consultor == 1;
    }

    public boolean getPertenceEtiquetaA(){
        return this.possui_projeto_a == 1;
    }

    public boolean getPertecenteEtiquetaB(){
        return this.possui_projeto_b == 1;
    }

    public boolean getMostrarEtiquetaB(){
        if(this.possui_projeto_a == 1){
            return false;
        }else return this.possui_projeto_b == 1;
    }

Here is the stack trace:

java.lang.NullPointerException
at com.labcon.r3e.entity.Projetista.getPertenceMembroR3e(Projetista.java:77)
at sun.reflect.GeneratedMethodAccessor511.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at javax.el.BeanELResolver.getValue(BeanELResolver.java:87)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at org.apache.el.parser.AstValue.getValue(AstValue.java:182)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:413)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:297)
at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:105)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:304)
at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)
at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:55)
at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:43)
at org.primefaces.component.layout.LayoutUnitRenderer.encodeEnd(LayoutUnitRenderer.java:51)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1764)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:424)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
    
asked by anonymous 05.08.2014 / 17:11

1 answer

2

The solution to the problem, as suggested by the Wakin user yesterday, was to set the Integers values to be null

    
06.08.2014 / 19:18