Skip to Content
Former Member
Dec 06, 2007 at 04:13 PM

Problem with Query Filter


Hi experts

I try to implement one find-method using more than one Query filters. the following is code:

public MyExampleList getAllMyExampleList(
	javax.xml.datatype.XMLGregorianCalendar fromDateStart,
	javax.xml.datatype.XMLGregorianCalendar fromDateEnd)
			throws {
		String method="getAllMyExampleList(XMLGregorianCalendar,XMLGregorianCalendar)";
		java.util.Date lowDate = DateUtils.toDate(fromDateStart);
		java.util.Date highDate = DateUtils.toDate(fromDateEnd);
		QueryFilter validFromDateFilter = null;
		List<QueryFilter> queryFilters = new ArrayList<QueryFilter>();
		if(lowDate != null && highDate != null) {
			validFromDateFilter = QueryFilterFactory.createFilterForBetween("validFrom", new Timestamp(lowDate.getTime()), new Timestamp(highDate.getTime()));
		  } else if(lowDate != null) {
			  validFromDateFilter = QueryFilterFactory.createFilter("validFrom", Condition.GE, new java.sql.Timestamp(lowDate.getTime()));

		  } else if(highDate != null) {
			  validFromDateFilter = QueryFilterFactory.createFilter("validFrom", Condition.LE, new java.sql.Timestamp(highDate.getTime()));

		  } else {
			  validFromDateFilter = QueryFilterFactory.createFilter("*");


		QueryFilter statusFilter =  QueryFilterFactory.createFilter("status", Condition.EQ, new Short((short)10)); //status = 10
		QueryFilter[] _filtersArray = new[queryFilters.size()];
		_location.debugT(method, "queryFilter size " + _filtersArray.length);
		myExampleServiceLocal myExampleService = this.getMyExampleService();
		List<MyExample> _list = (List<MyExample>)myExampleService.findByMultipleParameters(_filtersArray, false, "findByMultipleParameters");
		_location.debugT(method, "myExample list size: " + _list.size());
		MyExampleList allMyExampleList= new MyExampleList();
		return allMyExampleList;

As you see.. I have one Business object "MyExample". And I want to get a list of this objects with the following restriction:

1. between the validFrom and validTo (validFrom, validTo is the attributes of "MyExample")

2. the memberStatus is 10 (memberStatus is the attribute of "MyExample");

But I got the error as following: Unexpected QueryFilter at index 1. Expected QueryFilter which represents [OPERATION_OR|OPERATION_AND].

I use the Netweaver 7.1 SP3..

One advice from me: In the javadoc please give some examples how to use the method.

Thanks in advance and

Kind regards!