This is an extension library to the Spring Data JPA complex or dynamic SQL query. 这是一个比 MyBatis 更加强大的 Spring Data JPA 扩展库,为解决复杂动态 JPQL (或 SQL) 而生。https://blinkfox.github.io/fenix
Hibernate: SELECT TU.TW_GROUP, TU.ACTIVE, TU.TW_WEEK_FROM, TU.UNPOINT_ID, TU.HOUR_START, TU.MIN_START, TU.HOUR_END, TU.MIN_END, UD.TYPE, UD.NAME AS UNLOAD_DOOR_NAME, UD.PLANT_NO, TU.CREATE_TIME FROM TM_TIMEWINDOW_UNPOINT TU LEFT JOIN TM_UNPOINT_DOOR UD ON UD.ID = TU.UNPOINT_ID WHERE TU.DELETE_MARK = 'N' limit ?
Hibernate: select count(*) as count from , TU.UNPOINT_ID, TU.HOUR_START, TU.MIN_START, TU.HOUR_END, TU.MIN_END, UD.TYPE, UD.NAME AS UNLOAD_DOOR_NAME, UD.PLANT_NO, TU.CREATE_TIME FROM TM_TIMEWINDOW_UNPOINT TU LEFT JOIN TM_UNPOINT_DOOR UD ON UD.ID = TU.UNPOINT_ID WHERE TU.DELETE_MARK = 'N'
2023-02-02 15:47:14 WARN [http-nio-8873-exec-3] Caller+0 at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.logExceptions(SqlExceptionHelper.java:137)
- SQL Error: 1064, SQLState: 42000
方法和hibernate输出如下, 当查询语句的字段中有from的时候, count语句就生成错了 第二行的count语句将TU.TW_WEEK_FROM当做了from关键字