mysql单表递归查询(jpa[org.hibernate.QueryException: Space is not allowed afterQuery parameter prefix ':'])
来源:互联网 发布:山东外贸职业学院知乎 编辑:程序博客网 时间:2024/05/22 12:41
组织表字段id,及parentId,数据库mysql5.7
①解决的问题点:需要查出一个组织树结构,根据指定ID获取当前ID的所有子树。
select id,
parent_idfrom (select * from hrm_organization
order by parent_id, id) organization,
(select @pv := '18') initialisation
where find_in_set(parent_id, @pv) > 0
and @pv := concat(@pv, ',', id);
②解决的问题点:查出一条线性结构,查询当前ID的所有父级
SELECT
t.id,
@pv := t.parent_id
FROM
(
SELECT
*
FROM
hrm_organization
ORDER BY
id DESC
) t
JOIN (SELECT @pv := 31 from hrm_organization) tmp
WHERE
t.id =@pv;
③解决【:】错误问题:在:前加转义字符【\\】
SELECT @pv \\:= :organizationId
@Query(nativeQuery = true, value="SELECT id,name,budget_number,parent_id,description FROM hrm_organization WHERE del_flag = FALSE ORDER BY parent_id,id) organization, (SELECT @pv \\:= :organizationId) initialisation WHERE find_in_set(parent_id, @pv) > 0 AND @pv \\:= concat(@pv, ',', id) ")
0 0
- mysql单表递归查询(jpa[org.hibernate.QueryException: Space is not allowed afterQuery parameter prefix ':'])
- org.hibernate.QueryException: Space is not allowed after parameter prefix ':'
- org.hibernate.QueryException: Space is not allowed after parameter prefix ':'解决
- Space is not allowed after parameter prefix ':' MySQL异常
- Space is not allowed after parameter prefix ':' MySQL异常
- Space is not allowed after parameter prefix ':'(hibernate native sql “:” 冒号转义错误)
- hibernate异常--Oracle之Space is not allowed after parameter prefix ':'
- nested exception is org.hibernate.QueryException:could not resolve property:
- org.hibernate.QueryException: could not resolve property
- org.hibernate.QueryException: could not resolve property:
- org.hibernate.QueryException: could not resolve property
- org.hibernate.QueryException: could not resolve property:
- org.hibernate.QueryException: could not resolve property
- org.hibernate.QueryException: could not resolve property:xxxxxid 外键查询 hibernate
- 周报-org.hibernate.QueryException:Expected positional parameter count: 1,
- org.hibernate.QueryException:Expected positional parameter count: 1
- org.hibernate.QueryException: Expected positional parameter count: 2, actual parameters:
- mysql like 查询 有单引号的处理办法。org.hibernate.QueryException: expecting ''', found '<EOF>' [SELECT DISTINCT
- java设计模式24种之strategy-pattern设计模式
- 【转】 使用XHProf查找PHP性能瓶颈
- MPAndroidChart使用详解
- opencv边缘检测
- 【西瓜书】数据集分割与性能度量
- mysql单表递归查询(jpa[org.hibernate.QueryException: Space is not allowed afterQuery parameter prefix ':'])
- Android 工具类的两种写法---单例模式与静态方法
- 在OpenStack中创建网络
- nullptr模拟实现
- 蒙特卡罗方法入门
- 大数加法
- AsyncTask原理
- arcpy输入arcmap视图
- 文件分隔符和转义字符