Question

Given the following:

CriteriaQuery<SomeDTO> cQuery;
CriteriaBuilder cb;
Root<SomeClass> r;
...
cQuery.select(cb.construct(SomeDTO.class,
  "FIXED VALUE",
   r.get(SomeClass_.someValue)
));

Is there a way inwith the JPA criteria api and a static metamodel to create a select, which returns a fixed value for one column? The respective SQL should be something like

SELECT 'FIXED VALUE', someValue FROM someClassTable WHERE ...;

Thanks in advance!

Was it helpful?

Solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top