3 Jul 2012 16:21
ConcurrentModificationException loading facts from db (Hibernate).
groovenarula <gnarula1 <at> la-z-boy.com>
2012-07-03 14:21:07 GMT
2012-07-03 14:21:07 GMT
In my use case, I have ~ 200,000 rows in a table that I need lookup in order
to price an item. Rather than load the entire table into working memory,I'm
trying load the relevant rows (based on a matching criteria) and load those
as facts and then have my rules evaluate the loaded facts. Based on that
I've got the following rule :
rule "Load pricelist"
salience 10000
when
$priceUnit : PriceUnit()
not ( exists Pricelist( id.prodid == $priceUnit.prodid ) )
$unitPrices : ArrayList() from collect ( Pricelist() from
PricelistUtilities.getPriceLists($priceUnit.prodid) )
then
for( Pricelist priceList : (List<Pricelist>) $unitPrices ) {
insert (priceList);
}
end
In the rule above - 'PriceUnit' is the unit that I'm trying to price. And
'Pricelist' is the facts that I'm trying to fetch from a table based on the
prodid matching and inserting those into WM. The
PricelistUtilities.getPriceList returns a list of price list items that
match the 'Product id' (prodid). In the RHS, all I'm trying to iterate over
the list of pricelists and then insert those into WM.
When I execute the rule above, I can see that the rule is executing the
'select' to load pricelists :
(Continue reading)
RSS Feed