In the JPA, I defined a native sql which will return String,
@NamedNativeQuery(name = \"alert\", query = \" select distinct c.accountId from account c \",
In my case, I changed hibernate version from 3.5.6 to 4.3.3. it is working fine.
org.hibernate hibernate-core 4.3.3.Final org.hibernate hibernate-core 4.3.3.Final org.hibernate hibernate-entitymanager 4.3.3.Final