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.

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to