Please make sure the DB link you are using is Public and Shared, if the DB link is not Public and Shared it will throw an Exception ORA-24777: use of non-migratable database link not allowed. But if you try to run the same query directly on DB with out using any Java or XA transaction it will work fine.
njoy