Reputation: 1187
I'm trying to call the testResultDTO constructor with a boolean parameter but keep geting an error
TestResultDTO :
public class TestResultDTO extends AbstractDTO {
private Boolean test;
private Boolean locked;
public TestResultDTO() {
super();
}
public TestResultDTO(Boolean locked, Boolean test) {
super();
this.test = test;
this.locked = locked;
}
the query:
SELECT NEW com.xxx.model.dto.widgets.results.TestResultDTO(p.isLocked, IF((p.playerStatus = 'STANDARD'), false, true)) From player p Where p.id = 1
the error:
java.lang.NullPointerException
at org.hibernate.internal.util.ReflectHelper.getConstructor(ReflectHelper.java:355)
Is there a way to pass a boolean parameter hard coded ('true')??
Upvotes: 2
Views: 1834
Reputation: 116
The query may be like this :-
SELECT NEW com.xxx.model.dto.widgets.results.TestResultDTO(p.isLocked, CASE WHEN p.playerStatus = 'STANDARD' then false else true end) From player p Where p.id = 1 .
For reference : http://docs.jboss.org/hibernate/core/3.5/reference/en/html/queryhql.html#queryhql-expressions
Upvotes: 4