The generated SQL for queries with setRange could contain ambigous column names if more than 1 table is involved.
This is especially true if used with optimistic locking.
Example of generated SQL (stripped-down):
SELECT * FROM
(SELECT subq.*,ROWNUM rn FROM
(SELECT 'Order' AS NUCLEUS_TYPE, A0.BLOCKING_REASON, B0.CITY,
B0.VER, A0.ID AS NUCORDER0,
A0.VER FROM ORDERHEAD A0
LEFT OUTER JOIN ADDRESS B0 ON A0.DELIVERY_ADDRESS = B0.ID
WHERE A0.CUSTOMER = <'650024'> ORDER BY NUCORDER0 DESC
) WHERE rn <= 1
subq.* contains A0.VER and B0.VER, both with the column name VER. This leads to
java.sql.SQLSyntaxErrorException: ORA-00918: column ambiguously defined
This is not only a problem with optimitic locking. The problem with setRange will occur always, if two joined tables contain equal named columns.