Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] NullPointerException using Expression anyOf(...)

I can't see how a null-pointer could occur here, please verify the
null-pointer is not in your own code and include the exception and stack
trace.

Also include how you are executing the query with the expression.


rahul.thakur.xdev wrote:
> 
> Hello, 
> 
> I am building a query using ExpressionBuilder but running into an
> NullPointerException.
> 
> Here's my scenario: there's a Project entity with a one-to-many
> relationship with a WorkOrder.
> 
> I need to build a query (using inputs from a Search form), if a Project
> name or code were submitted, I need to include that criteria, plus I need
> to include criteria specifying WorkOrder Number (alpha-numeric). 
> 
> So, here's what I created (snippet below), but I see a
> NullPointerException coming from the implementation of anyOf(...) method.
> I am wondering if I am using it the wrong way or perhaps if its an
> EclipseLink bug that I am running into. 
> 
> Much appreciate any pointers. 
> 
> Thanks, 
> 
> Rahul 
> 
> 
>                         ExpressionBuilder project = new
> ExpressionBuilder();
> 			Expression exp = null;
> 
> 			if (null != this.projectNameNumber
> 					&& !this.projectNameNumber.trim().equals(""))
> 				exp = project.get("name").like(
> 						"%" + this.projectNameNumber + "%").or(
> 						project.get("code").like(
> 								"%" + this.projectNameNumber + "%"));
> 
> 			if (null != this.workOrderNumber
> 					&& !this.workOrderNumber.trim().equals("")) {
> 				if (null != exp)
> 					exp = exp.anyOf("workOrders").get("code").like(
> 							this.workOrderNumber);
> 				else
> 					exp = project.anyOf("workOrders").get("code").like(
> 							"%" + this.workOrderNumber + "%");
> 			}
> 
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/NullPointerException-using-Expression-anyOf%28...%29-tp23854945p23963705.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top