I have a SQL Server database with a Person table and I want to load a list of these people from the database to an Arraylist or List in the BRMS to apply the rules. how can I do this?
Asked
Active
Viewed 247 times
1
-
You need to write drools function which will connect to DB fetch table record put them into Variable of type List and then pass that variable to rule. – Abhijit Humbe Jul 16 '17 at 13:56
-
Exactly as you said it, is working :) ty. – Jdgarzon64 Jul 18 '17 at 19:06
1 Answers
0
The best practice is to delegate the data retrieval logic to the caller. The pattern should be:
- Retrive the data from a DB or whatever
- Fill in the data in the Working Memory
- Fire the rules
- Collect the results
- Depending on the application you can use the results to update a DB
The BRMS has the ability to retrieve data in the rule logic but it should be considered a bad practice, or something to do when no other options are available (really rare case, in rare situation). Otherwise, the BRMS performances will be terrible and the overall code really hard to maintain.

dmarrazzo
- 175
- 7