Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

match by crypto doesn't work #156

Open
vitalz opened this issue Aug 17, 2018 · 1 comment
Open

match by crypto doesn't work #156

vitalz opened this issue Aug 17, 2018 · 1 comment

Comments

@vitalz
Copy link

vitalz commented Aug 17, 2018

Database SQL:

`CRYPTO_source_id` VARBINARY(64) NOT NULL,

Cayenne model:

<db-attribute name="CRYPTO_source_id" type="VARBINARY" isMandatory="true" length="64"/>

<obj-attribute name="sourceId" type="int" db-attribute-path="CRYPTO_source_id"/>

LinkMove match by:

.matchBy(SomeEntity.SOURCE, SomeEntity.SOURCE_ID)

There is Source ID is being encrypted column.

During targets being matched to sources process, at TargetMatcher.match(ObjectContext, Map<Object, Map<String, Object>>) no targets are being obtained:

[17/Aug/2018:05:14:26,432] bootique-job-1  INFO  o.a.c.l.JdbcEventLogger: SELECT t0.source, t0.CRYPTO_source_id /* some more fields */ FROM my_schema.some_entity t0 WHERE (t0.source = ?) AND (t0.CRYPTO_source_id = ?) [bind: 1->source:'cdn', 2->CRYPTO_source_id:1]
[17/Aug/2018:05:14:26,480] bootique-job-1  INFO  o.a.c.l.JdbcEventLogger: === returned 0 rows. - took 537 ms.

Though the according target is existing LinkMove will produce a duplicate.

@vitalz
Copy link
Author

vitalz commented Sep 14, 2018

There is a workaround to implement your custom Mapper and it will match (pre-selected in memory) targets for incoming sources at @AfterTargetsMatched.

 .matchBy(new CustomMapper())
ObjectSelect.query(Custom.class).select(
    segment.getContext()
)

There is an idea that:

mapper.keyForTarget(customObj) === mapper.keyForSource(incomingSource)
@AfterTargetsMatched
public void AfterTargetsMatched(Execution exec, CreateOrUpdateSegment<Custom> segment) {
        // some code
	segment.setMatchedTargets(customTargets);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant