I am using the following named query to get results from the database based on parameters I am passing from a JSP page.
<query name="getData"><![CDATA[
select
a.name,a.desc,a.reportname,b.manname,b.mandata
from
product as a inner join
a.manufacturer as m
where
m.name like :manufacturer and
a.description like :description and
((a.percentSize <= :sizeMax and
a.percentSize >= :sizeMin) or
a.percentSize is null) and
((a.wingSpanInches <= :spanMax and
a.wingSpanInches >= :spanMin) or
a.wingSpanInches is null) and
((a.recommendedAuwMinLbs <= :auwMax and
a.recommendedAuwMaxLbs >= :auwMin) or
a.recommendedAuwMaxLbs is null)
]]></query>
Not all the search parameters are mandatory (some values I am getting are null). How do I exclude parameters if they are null?