In the JPA, I defined a native sql which will return String,
@NamedNativeQuery(name = \"alert\", query = \" select distinct c.accountId from account c \",
Seems Hibernate only allows Entity result classes. Obviously not all JPA implementations have this restriction. DataNucleus JPA, for example, allows that query to run fine.