I am using hibernate. I need to create query below. It is possible the subContest is null in which case `subContest_id=:cont` should NOT be part of where clause. In conventional SQL when creating dynamic sql ; for such cases I used to do `subContest_id = subContest_id ;` BUT how do I achieve it in case below. Here If I try to `query.setParameter( "cont", "subContest_id " );` it will give exception as cont is supposed to be an id and not a string.

```
    Query query = getEntityManager().createQuery( "select * from Upload where moderated=:mod, subContest_id=:cont order by lastModifiedTime desc " );
    query.setParameter( "cont", subContest.getId() );

```