On Fri, May 30, 2008 at 5:06 PM, Thalupula Ravi <thalupularavi(a)gmail.com> wrote:
Can some one describe about advantages and disadvantages of below to
1. Interacting Database for information in rule ( using "from" or something
2. Required information supplied to rules in the form facts at one shot by
client instead of again hitting the database.
Thanks for your help:handshake:
if you're going to use "from" in your rules, you should make sure that
you provide some extra methods in your DAOs instead of only some
generic "getAll()" method. This way, if there are some hundred
thousands records in your database, Drools will not have to
instantiate an object for each of them since the DAO/database can
filter out those objects that are not relevant to the use case.
If, for example, you write some rule that handles order processing,
you could write a DAO method "getUnprocessedOrders()" which will
ignore all orders that are already processed. AFAIK Drools does no
sharing/caching of objects retrieved via equivalent "from" calls in
When planning my current project, I quickly found that manually
retrieving the objects and inserting them into the working memory gave
me somewhat more flexibility but that of course depends on the use
case at hand.