|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
NullPointerException using Expression anyOf(...)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 + "%"); } |
|
|
Re: 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.
James Sutherland EclipseLink, TopLink Wiki: EclipseLink, TopLink Forums: TopLink, EclipseLink Book: Java Persistence |
| Free embeddable forum powered by Nabble | Forum Help |