Hi all,
Since yesterday, I am having a problem with reading inserted objects from
memory. I don't know why it does not go as planned, because it should be
quite straightforward. It is getting boring to stare at the code, so maybe
one of you can detect an error.
There are 2 kinds of rules. One kind inserts price objects into working
memory (as in example 1). THe other kind detects whether the price exists
and adapts it to a product (as in example 2).
Example 1 seems to work, but the engine does not seem to recognize them as a
Price object. All original price attributes of the products remain unchanged
unless:
- I manually insert a Prce object before calling fireAllRules()
or
- Checking for an existing price is commented out in the LHS
Removing constraints from $price (just checking for existance of a price)
does not help.
Any idea what has been going wrong?
Thanks in advance.
==============Example 1=================
rule "Prices_17"
lock-on-active true
when
then
Price $price = new Price();
$price.setName("Blue autumn");
$price.setPrice(6);
insert($price);
System.out.println("Price " + $price.getName() + " inserted");
end
=============Example of usage=========================
rule "Products_36"
lock-on-active true
when
$product: Product(colour == "Blue")
Season(season == Season.AUTUMN)
$price: Price(name == "Blue autumn")
then
$product.setPrice($price.getPrice());
update($product);
System.out.println("Rule executed");
end
===================================================
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Object-insertion-on-r...
Sent from the Drools - User mailing list archive at
Nabble.com.