[rules-users] Guvnor, database and rule language

Anu@work anupama.vaid at bluecasa.com
Wed Apr 1 12:22:07 EDT 2009


Drools is surprisingly one of the most intuitive tools I have used. I did
Java about 6 yrs back and most of the things I work on with Drools work the
first time or as soon as I get the basics right. So the code below works in
guvnor. I had to change the source code of the Drools Execution Server to
instantiate and pass a hibernateSession as a global to the drools stateless
session for rule execution. 

I then defined hibernateSession as a global in guvnor and used it in a rule. 

when
  cust1:Customer();		
  cust:Customer() from hibernateSession.createQuery("from Customer where
custNbr=:custnbr").setProperties({"custnbr":cust1.getCustNbr()}).list();

then
  cust1.setBalance(cust.getBalance());	
  cust1.setCustNbr(cust.getCustNbr());

Thx for your help Greg. And btw, I query for only one customer and I cannot
insert that one customer in working memory prior to rule because Drools
execution server is generic and does not know what client might request. But
this works. 
-- 
View this message in context: http://www.nabble.com/Guvnor%2C-database-and-rule-language-tp22810206p22829928.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list