Yes, it can, but you can get primitives only in "select" methods, not in "finders"
Exam 1Z0-810: Upgrade to Java SE 8 Programmer Study Guide and Quiz Exam 1Z0-817: Upgrade OCP Java 6, 7 and 8 to Java SE 11 Developer Study Guide and Quiz
posted 16 years ago
here is the example:
The following EJB QL query selects the names of all products that have been ordered. It illustrates the selection of values other than entity beans, therefore it can be used only for SELECT methods, not for FINDER methods: