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

Hi Rick,

Thanks for the tip, but EclipseLink still tries to fetch the FK object.

Any other hints?

I have my code published on github here: https://github.com/lukaszbudnik/eclipselink-multitenant

There are 2 unit tests:

ConfigurationDaoTest (configuration uses transformations to do encryption) all tests pass green.

TestRunDaoTest which tests a foreign key to encrypted configuration is marked with @Ignore because it fails because EclipseLink tries to do a select from db (and configuration is encrypted).

So any other ideas?

thanks,
Łukasz
 

On 22 December 2014 at 02:33, Rick Curtis <curtisr7@xxxxxxxxx> wrote:
Ł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

_______________________________________________
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


Back to the top