I have a constructor criteria query. For the constructor, I’m attempting to do something like this:
query.select( builder.construct( MyView.class
, metaObject
, builder.selectCase( builder.isNull( metaOtherObject )).when( true, null ).otherwise( metaOtherObject.get( MetaOtherObject_.myDateField ))
));
If I use when(true,null) then I get a NullPointerException on that line. If I use something like when(true,new Date()) then it looks alright. Problem is, I need to be able to pass a null in there if the OtherObject wasn’t found. How can I do that?
I’m using eclipselink as the provider hitting postgres.
Looks like I need to use the CriteriaBuilder literal or nullLiteral methods. Something like
While my query still fails, it isn’t in the constructor portion where I was trying to use just
nulldirectly. I believe the other problems are unrelated to this.