jpa左连接查询写法实例

@Query(value = "SELECT a.id,a.user_name,a.room_type,a.rent_type,b.name,b.id AS room_id,b.cell,b.floor,b.type,b.sorter  FROM gzf_room b LEFT JOIN gzf_rent_info a ON a.room_id = b.id WHERE b.parent_id = ?1", nativeQuery = true)
@QueryHints({@QueryHint(name = "org.hibernate.cacheable", value = "true")})
List<Object[]> findByRoomHome(Long id);

发表评论

邮箱地址不会被公开。