I have an entity that references another entity (but it can have no reference)
I have a page that displays all of the first entity, and the second entity if there is one.
The query is:
select a from Addresses a left join fetch a.associatedVendor
The associatedVendor is going to be null sometimes. This is ok.
I tried to make it so that when the associated Vendor is null, it would simply not render, but that did not work.
I get an error that says
Unable to find com.company.project.entity.Vendors with id 10
This is the relevant xhtml
<rich:dataTable var="eachAddress" value="#{allAddresses}" rendered="#{not empty allAddresses}"> <rich:column> <h:outputText value="#{eachAddress.associatedVendor.vendorName}" rendered="#{eachAddress.associatedVendor != null}"/> </rich:column> </rich:dataTable>
How can I go about displaying the associatedVendor when it can potentially be null/non-existant