[rules-users] Guvnor, database and rule language

Anu@work anupama.vaid at bluecasa.com
Tue Mar 31 16:04:16 EDT 2009


I am trying to use drools to evaluate the following rule:

Given a telephone number, if the telephone number already exists in database
and has a balance > 0, set isAllowed = false. I cannot figure out how to
write the rule. 

This is my object

public class Customer implements Serializable {
	private static final long serialVersionUID = 1L;
	private String tn;
	private Double balance;
        private Boolean isAllowed;

        // getters/ setters
}

Can anyone help me with the rule below? The TN is set in the input fact. Is
the query below correct? It looks incorrect. 

global org.hibernate.Session hibernateSession;

when 
    cust1:Customer()
    cust2:Customer() from hibernateSession.createQuery("Select * from
Customers Where TN = :tn and balance >
0).setProperties({"tn":cust1.getTn()})list()

then
    cust1.setIsAllowed(false);



-- 
View this message in context: http://www.nabble.com/Guvnor%2C-database-and-rule-language-tp22810206p22810206.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list