Skip to main content

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

Łukasz -

I haven't tested this scenario to see how EclipseLink behaves, but take a look at EntityManager.getReference(...)... It might be what you are looking for.

Thanks,
Rick

On Sun, Dec 21, 2014 at 4:41 PM, Łukasz Budnik <lukasz.budnik@xxxxxxxxx> wrote:
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

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


--
Rick Curtis

Back to the top