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

Fixes chained join method's signature in the QueryBuilder #252

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

derenio
Copy link

@derenio derenio commented Oct 26, 2015

No description provided.

@jeffdgr8
Copy link

@greenrobot @greenrobot-team can this fix be looked at merging? Anyone that's doing chained joins has to be casting the sourceJoin argument here to the incorrect Join<?, T> in order for the method to accept the argument. Your own chained join sample won't compile with the code as is.

Part of the problem is that the return type of the method actually isn't Join<T, J>, but rather Join<J, K>, as the QueryBuilder's T is not the intended type of the chained join, rather it's joining to a new K type, from the J type of the previous join. The method signature would be more appropriate as:

public <J, K> Join<J, K> join(Join<?, J> sourceJoin, Property sourceProperty, Class<K> destinationEntityClass, Property destinationProperty)

And addJoin() would more correctly be:

private <J> Join<?, J> addJoin(String sourceTablePrefix, Property sourceProperty, AbstractDao<J, ?> destinationDao, Property destinationProperty)

as the join may be from T in the non-chained join() methods or it may be from a chained type from the chained join() method.

@jeffdgr8
Copy link

I created a pull request with the fix I described above: #913.

This pull request fix will work, but the type of the Join generics are still incorrect, which although they're not actually used, can be misleading.

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

Successfully merging this pull request may close these issues.

2 participants