Say you have a QueryDSL query as follows:
JPQLQuery query = new JPAQuery(em);
QUser user = QUser.user;
QLocation location= QLocation.location;
query.from(User).innerJoin(user.location, location).where(user.name.eq("Giuseppe").and(location.name.eq("Vatican City")));
How is that different (functionally) from the following?
JPQLQuery query = new JPAQuery(em);
QUser user = QUser.user;
query.from(User).where(user.name.eq("Giuseppe").and(user.location.name.eq("Vatican City")));
It seems to me that both are able to resolve the condition stating that the user's location must be Vatican City. Also, both return objects that allow navigation across the object graph.
So is there any difference? Why not just use the second, more compact one?
Edit: they generate different JPQL, that's for sure, but I'm not sure that the end result is any different. Why would we ever want to explicitly list what join we're doing?
Edit 2: Seems like they might be identical... http://docs.jboss.org/hibernate/orm/4.2/devguide/en-US/html/ch11.html#d5e2888