Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Example of leftJoin?
Example of leftJoin? [message #1272458] Mon, 17 March 2014 20:36 Go to next message
brad Mising name is currently offline brad Mising name
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 08:35 Go to previous message
Chris Delahunt is currently offline Chris Delahunt
Messages: 1016
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 Jul 25 16:51:56 EDT 2014

Powered by FUDForum. Page generated in 0.01998 seconds