1.因需要查询实体表中的code,name两个字段,百度说可以自定义查询实体类如:public class Entity implements Serializable(){ String code ; String name ;
... public Entity (String code, String name) { super(); this.code = code; this.name = name;
}
}sql语句@Query(value = "select new com.Vo.Entity(code,name) FROM user")
List<Entity> selectEntity();这样就能将数据库查询的user表中的code和name字段自动添加到entity实体中,现在保错如下:2018-08-31 18:44:45.113 DEBUG 8528 --> [nio-8080-exec-2] [ org.hibernate.SQL] : select new com.Vo.Entity(code,name) FROM user 2018-08-31 18:44:45.448 WARN 8528 --> [nio-8080-exec-2] [ o.h.engine.jdbc.spi.SqlExceptionHelper] : SQL Error: 923, SQLState:42000 2018-08-31 18:44:45.452 ERROR 8528 --> [nio-8080-exec-2] [ o.h.engine.jdbc.spi.SqlExceptionHelper] : ORA-00923: 未找到要求的 FROM 关键字明明是有from的为什么报未找到From关键字呢?
添加回答
举报
0/150
提交
取消