javatoplinktoplink-essentialsejbql

Toplink bug. Empty result for valid sql with not empty result


How is it possible?

We are executing EJBQL on Toplink(DB is Oracle) and query.getResultList is empty.

But! When i switched log level to FINE and received Sql query, that TopLink generates, i tried to execute this query on database and (miracle!) i got a non-empty result!

What could be the reason and how is it treated? Thanks in advance!

P.S. No exceptions.

UPDATE:

Query log:

SELECT DISTINCT t0.ID, t0.REG_NUM, t0.REG_DATE, t0.OBJ_NAME, t1.CAD_NUM, t1.CAD_NUM_EGRO, t2.ID, t2.DICT_TYPE, t2.ARCHIVE_DATE, t2.IS_DEFAULT, t2.IS_ACTUAL, t2.NAME, t0.INVENTORY_NUM FROM CODE_NAME_TREE_DICTIONARY t3, DEFAULTABLE_DICTIONARY t2, IMMOVABLE_PROP t1, ABSTRACT_PROPERTY t0 WHERE ((t3.ID IN (SELECT DISTINCT t4.ID FROM CODE_NAME_TREE_DICTIONARY t5, CODE_NAME_TREE_DICTIONARY t4, type_property_parents t6 WHERE (((t5.ID = ?) AND (t4.DICT_TYPE = ?)) AND ((t6.type_property_id = t4.ID) AND (t5.ID = t6.parent_id)))) AND ((t1.ID = t0.ID) AND (t0.PROP_TYPE_DISCR = ?))) AND ((t3.ID = t0.PROP_TYPE) AND ((t2.ID (+) = t1.STATUS_ID) AND (t2.DICT_TYPE = ?)))) ORDER BY t0.REG_NUM ASC
    bind => [4537, R, R, realty_status]|#]

This query returns 100k rows, but toplink believes that it is not...


Solution

  • I found the reason! The reason is Oracle! I've tried the same code on Postgres and its worked!

    I dont know why, but in some magic cases oracle ignores query parameters and query returns empty result.