If you are using the OQL module create the association between the NPE and the entity that you are retrieving via the OQL java action. Then from the NPE you can retrieve the original object and create the association in the microflow where you called the OQL action.
From the documentation of the module:
In the example above, the resulting columns Name, Number, DateOfBirth, Age, etc. are mapped to their corresponding attributes in ExamplePersonResult. The column ExamplePersonResult_ExamplePerson is mapped to the association (so one can retrieve the original persistent entity if needed).