Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception on raw query #1070

Open
mecoFarid opened this issue Apr 3, 2021 · 0 comments
Open

Exception on raw query #1070

mecoFarid opened this issue Apr 3, 2021 · 0 comments

Comments

@mecoFarid
Copy link

I'm trying to fetch the parent hierarchy of a given Department with the query below. Probably this is something GreenRobot can't handle. Is there any alternatives to run a pure SQL query in this library?

mDaoSession.getPlaceDepartmentItemDao().queryRawCreate("" +
                ";WITH CTE AS " +
                "(" +
                    "SELECT a.PID, a.ID, a.LEVEL, a.NAME  " +
                    "FROM PLACE_DEPARTMENT_ITEM a " +
                    " WHERE ID = ?" +
                    "UNION ALL   " +
                    "SELECT a.PID, a.ID, a.LEVEL, a.NAME  " +
                    "FROM PLACE_DEPARTMENT_ITEM a " +
                    "JOIN cte c ON c.PID = a.ID" +
                ")" +
"SELECT *  FROM CTE ORDER BY CTE.LEVEL DESC", departmentId)
.list();

GreenDao throws the following exception:

java.lang.IllegalArgumentException: Cannot bind argument at index 1 because the index is out of range. The statement has 0 parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant