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: 1039
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: Thu Dec 18 20:30:55 GMT 2014

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

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