flowable / flowable/flowable-engine

multi-tenant Query error: when i use latest version search in modelQuery, the error occurs.

Open
#3,575 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
7h 8m
Merged PRs (30d)
2

Description

In my saas platform, i have two tenant here.
In tenant A, i defined a process and designed the model with key 'editor',and got its version to 2。then i exported this process definition(procX)。
In tenant B, i imported this process definition(procX)。Its key is still editor, with version 1。
then this error accurs, when i get list of process models with latest versioin,i got nothing。but when i got one model list when i used no latest version。

**I saw the sql printed, like this:**
select *
from ACT_RE_MODEL RES
WHERE
RES.VERSION_ = (select max(VERSION_) from ACT_RE_MODEL where KEY_ = RES.KEY_)
and RES.TENANT_ID_ = ?

**the problem is**: there is no tenant_id in the above subquery。

**Expected behavior**
The query should be like this:
select *
from ACT_RE_MODEL RES
WHERE
RES.VERSION_ = (select max(VERSION_) from ACT_RE_MODEL where KEY_ = RES.KEY_ **and TENANT_ID_= ?**)
and RES.TENANT_ID_ = ?

BTW: i use ModelQuery to finish my job and the flowable version is 6.6。
I know navite sql may be a way to solve this problem, but i expect ModelQuery and all other Query APIs can do this well.

thanks for your good work.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.