Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Example of leftJoin?
Example of leftJoin? [message #1272458] Tue, 18 March 2014 00:36 Go to next message
brad Mising name is currently offline brad Mising nameFriend
Messages: 17
Registered: February 2010
Junior Member
I want to use leftJoin with the optional onClause. I have been unable to get this to work. Here's the example from the documentation for ExpressionBuilder.leftJoin:
 Expression address = employee.getAllowingNull("address");
 employee.leftJoin(address, address.get("city").equal("Ottawa"));
 query.addNonFetchJoin(address);

Here's my code
JpaQuery<Entity> query = (JpaQuery<Entity>) japEm.createQuery(expression, entityClass);
ReadAllQuery raQuery = (ReadAllQuery) query.getDatabaseQuery();
Expression insurance = expressionBuilder.anyOfAllowingNone("insurances");
expressionBuilder.leftJoin(insurance, insurance.get("insuredIdNumber").equal("11111111"));
raQuery.addNonFetchJoin(insurance);

return query;

Thoughts?
Re: Example of leftJoin? [message #1272659 is a reply to message #1272458] Tue, 18 March 2014 12:35 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
I'm not sure where you got the example from, but it is using an EclipseLink query object and expressions to build a query while you are using JPA and then trying to modify the EclipseLink query underneath. It is possible, but you would be better off sticking with EclipseLink's JPA support for the ON clause, which was not a part of the JPA specification. EclipseLink supports the use of the ON clause in JPQL, and in criteria queries if you cast the join to org.eclipse.persistence.internal.jpa.querydef.JoinImpl
An example is posted here http://stackoverflow.com/questions/14315547/eclipselink-extend-join-clause
Previous Topic:Help migrating (JEE6 + jboss + hibernate + jds) resolved
Next Topic:append Postgres Full Text Search expression after having CriteriaQuery
Goto Forum:
  


Current Time: Fri Apr 19 21:10:50 GMT 2024

Powered by FUDForum. Page generated in 0.03482 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top