UNION operator with QueryBuilder

2019-08-08 04:21发布

问题:

I want to create a SELECT statement, which is a union of two sub-queries. Is there any way in ORMLite to create the two queries with QueryBuilder, and then concatenate them and create a UNION like this with a third QueryBuilder:

SELECT * FROM (
        FIRST SELECT
        UNION 
        SECOND SELECT)
    WHERE isdefault = 0 ORDER BY someRow;

someRow also changes dinamically. As for as i know QueryBuilder does not support UNION directly, so somehow i should inject the concatenated union into its statement. As the result i want to get a List<MyObject> like QueryBuilder.query() returns it.