Variable binding of a property of Map element causes unexpected result in executable model.

Solution Unverified - Updated -


Building and executing a rule written in MVEL dialect that accesses a Map element and binds a property of the element to a variable in executable rule model, the bound variable is an unexpected value.

For example, when I build and execute a rule (*1) which uses a statement like (*1-1) with java code (*2) with executable rule models enabled,

(*1) rule

package com.example.reproducer

import com.example.reproducer.Car

dialect "mvel"

rule "rule1a3"
        $car : Car( $supplierName : suppliers["transmission"].name )    // ..... (*1-1)
        System.out.println("***** Action of rule1a3");
        System.out.println("***** $car: " + $car + ", transmission supplier name = " + $supplierName);
// suppliers is a {{Map<String, Supplier>}} type property of Car class

(*2) java code

Car a = new Car("A180");
Map<String, Object> specs = new HashMap<>();
specs.put("transmission", "8-speed automatic");
Map<String, String> parts = new HashMap<>();
parts.put("transmission", "T8SAT");
Map<String, Supplier> supls = new HashMap<>();
supls.put("transmission", new Supplier("ABC Precision Instruments"));

System.out.println("***** start");
System.out.println("***** end");

$supplierName value will not be "ABC Precision Instruments" (the name property of Supplier object) but "A180" (the name property of Car object) unexpectedly.

$ mvn clean compile exec:exec -DgenerateModel=YES
***** Action of rule1a3
***** $car: com.example.reproducer.Car@4b6690c0, transmission supplier name = A180


  • Red Hat Decision Manager (RHDM)
    • 7.1.0 - 7.9.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content