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

Support JOIN/ON for two root entities #128

Closed
lukasj opened this issue Mar 29, 2016 · 7 comments · Fixed by #467
Closed

Support JOIN/ON for two root entities #128

lukasj opened this issue Mar 29, 2016 · 7 comments · Fixed by #467

Comments

@lukasj
Copy link
Contributor

lukasj commented Mar 29, 2016

Currently JPA does not allow root entities after various JOIN clauses which means that especially outer joins cannot be specified and executed without association path. In some cases it may be beneficial when we can join even when the relation is not mapped, e.g. to avoid potentially EAGER One- or @manytoone relationship (LAZY is only hint, not guaranteed).

EclispeLink currently supports such joins and they add a lot of options how to solve some problems with a minimal JPQL change. "EclipseLink also supports usage of the ON clause between two root level objects." See: https://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Querying/JPQL#ON

Please, consider root entites as candidates for joins.

@lukasj
Copy link
Contributor Author

lukasj commented Mar 29, 2016

@glassfishrobot Commented
Reported by virgo47

@lukasj
Copy link
Contributor Author

lukasj commented Mar 29, 2016

@glassfishrobot Commented
neilstockton said:
+1 for allowing JOIN to be to another "root" element. DataNucleus JPA also provides that IIRC.

But think this won't apply to "FETCH JOIN" which still needs to be along a relation, hence spec needs to distinguish the syntax difference between JOIN and FETCH JOIN.

@lukasj
Copy link
Contributor Author

lukasj commented Aug 2, 2016

@glassfishrobot Commented
c.beikov said:
Hibernate also supports this kind of joins as of version 5.1: http://in.relation.to/2016/02/10/hibernate-orm-510-final-release/

@lukasj
Copy link
Contributor Author

lukasj commented May 5, 2017

@glassfishrobot Commented
This issue was imported from java.net JIRA JPA_SPEC-128

@lukasj
Copy link
Contributor Author

lukasj commented Aug 31, 2018

@gavinking
Copy link
Contributor

To be clear, we're talking about queries like this:

select book.title, publisher.name
from Book book
    join Publisher publisher
        on book.publisher = publisher
where book.title like :titlePattern

Correct?

If so, then this is something that both EclipseLink and Hibernate have supported for quite a long time, and it's something that should be quite trivial to add to the spec.

I would say we can easily do this for 3.2.

@gavinking
Copy link
Contributor

Please review proposal #467, which also cleans up some of the language in that section of the spec.

gavinking added a commit to gavinking/jpa-api that referenced this issue Aug 24, 2023
gavinking added a commit to gavinking/jpa-api that referenced this issue Aug 24, 2023
gavinking added a commit to gavinking/jpa-api that referenced this issue Aug 24, 2023
gavinking added a commit to gavinking/jpa-api that referenced this issue Aug 24, 2023
lukasj pushed a commit that referenced this issue Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants