JPA native query return class

后端 未结 4 796
别跟我提以往
别跟我提以往 2021-02-06 06:32

In the JPA, I defined a native sql which will return String,

@NamedNativeQuery(name = \"alert\", 
query = \" select distinct c.accountId from account c \", 
            


        
4条回答
  •  北恋
    北恋 (楼主)
    2021-02-06 06:54

    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.

提交回复
热议问题