I need to take hql that is currently :
select distinct a from Asset as a where ...
and change it to
select new com.org.AssetDTO(a.id, a.address, a.status) from Asset as a where ...
My problem is with the distinct keyword. Where does it belong in an hql query where you're using the new Object query type. One thought was to use a sub-select and have my distinct there. I've tried adding distinct a.id
but that doesn't work.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…