简体   繁体   中英

Anylogic java Querydsl wrong result with and()

I have the database c2d_selfpickup in the Anylogic model:

在此处输入图像描述

I have to find the c2d_lm value by SCid and PVZid using QueryDSL:

List <Double> c2dlmList = selectFrom(c2d_selfpickup)
                            .where(c2d_selfpickup.sc_id.goe(SCid)
                            .and( c2d_selfpickup.pvz_id.goe(PVZid) ))
                            .list(c2d_selfpickup.c2d_lm);

If I choose the next pair:

int SCid = 256151;
int PVZid = 547307;

I expect that the query returns c2dlmList with one value 8.0 (the row number 8), but it returns 7 values:

[2.0, 3.0, 4.0, 5.0, 6.0, 8.0, 10.0]

What I do wrong?

Thanks a lot.

The result is actually correct. The query considers all entries in the database, so it will return all rows where sc_id >= 256,151 and pvz_id >= 547,307 (goe = greater or equal).

In case you only want to get the row that exactly matches both conditions, you may want to use eq() instead of goe() .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM