Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] setting FK makes EclipseLink to fetch foreign object

Hi all,

I'm preparing quite a complex POC for my project. My project uses multitenant DB, plus quite a few of my entities are encrypted.

The issue I have is with setting FK to an object which is encrypted.

To cut long story short. I've noticed that when in eclipse link you set the relationship in Java code like this:

a.setB(b);

I hopped that EclipseLink would take @Id field from B object and set it into FK column for A.

But it looks like EclipseLink does not believe me and tries to verify if B object with given id really exists in db. When I enabled SQL logger I saw that indeed eclipse link before setting FK did a query like this:

select ... from b where id = ?

and the id was set to the @Id field of the b object.

But in my case this select will not work because B is encrypted and I have custom  FieldTransformer and AttributeTransformer to handle encryption and decryption of B entity.

Is there a setting to tell EclipseLink not to verify FK and just blindly set it?

thanks,
Łukasz

Back to the top