Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7564913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:00:50+00:00 2026-05-30T14:00:50+00:00

Looking for query language to work with java objects. Found MQL ( Mule Query

  • 0

Looking for query language to work with java objects. Found MQL ( Mule Query Language ).
It’s in beta, I didn’t find much documentation. tried couple of things like where clause and select clause. But order clause is not working.

List users = new ArrayList(); 
users.add(new User("Dan", "Dan.Diephouse@gmail.com",2,13000 , address)); 
address = new Address("International pkway","Atlatna","GA","USA"); 
users.add(new User("Joe", "Joe.Sales@yahoo.com", 1,14000, address)); 
users.add(new User("John", "John@yahoo.com", 1,16000, address)); 
users.add(new User("Scott", "scott@yahoo.com", 1,15000, address)); 
users.add(new User("Andy", "andy@abc.com", 1,7000, address)); 

Query query = new QueryBuilder() 
.as("p") 
.orderby("income") 
// .max(3) 
.where(eq(property("companyId"), 1)) 
.select(newObject() 
.set("name", "name") 
.set("income", "income") 
.set("email", "email")).build(); 

Collection result1 = query.execute(users); 

Please let me know , if any one has luck playing with MQL or suggest any other good framework to query java objects.


Another error – when the result set is not hashmap.

Exception in thread “main” java.lang.ClassCastException: com.mql.test.User cannot be cast to java.util.Map
at com.mulesoft.mql.impl.OrderByComparator.compare(OrderByComparator.java:11)
at java.util.Arrays.mergeSort(Arrays.java:1270)
at java.util.Arrays.sort(Arrays.java:1210)
at java.util.Collections.sort(Collections.java:159)
at com.mulesoft.mql.Query.order(Query.java:214)
at com.mulesoft.mql.Query.execute(Query.java:189)

    List persons = getPersons();

    Query query = new QueryBuilder()
    //  .where(and(eq(property(“division”), “Sales”),
    // eq(property(“firstName”), “Joe”)))
    .orderby(“income”)
    .max(3)
    .build();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T14:00:52+00:00Added an answer on May 30, 2026 at 2:00 pm
      public int compare(Object o1, Object o2) {
    
            Object r1 = null, r2 = null;
            if(o1 instanceof Map && o2 instanceof Map) {
                Map<String,Object> o1Map = (Map<String,Object>) o1;
                Map<String,Object> o2Map = (Map<String,Object>)  o2;
                 r1 = MVEL.executeExpression(expression,o1Map.get(queryBuilder.getAs()), o1Map);
                 r2 = MVEL.executeExpression(expression, o2Map.get(queryBuilder.getAs()), o2Map);
    
            }else {
                 r1 = MVEL.executeExpression(expression,  o1);
                 r2 = MVEL.executeExpression(expression,  o2);
    
            }
    
    
            if (r1 instanceof Comparable && r2 instanceof Comparable) {
                return ((Comparable)r1).compareTo(r2);
            }
    
            if (r1 == null && r2 == null) {
                return 0;
            }
    
            if (r1 == null) {
                return -1;
            }
    
            if (r2 == null) {
                return 1;
            }
    
            return r1.toString().compareTo(r2.toString());
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking into LINQ and the query language appears (at least on the surface)
Am looking for a query to sum values in a particular time duration say
I am looking at the query syntax . and i could not figure out
Looking to have a database query set all the instance variables in a class:
I'm looking for a way to query the ink level for my Epson DX
I'm preferably looking for a SQL query to accomplish this, but other options might
I'm looking to build a query that will use the non-clustered indexing plan on
I am looking to create a SQL query that collects the results from multiple
i am looking for an SQL query, that selects exactly rows ordered by date
I'm looking for help with my query below. which is never returning anything for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.