Re: [rules-users] Call class method from LHS of a rule

2010-03-25 Thread HafeezurRehman
/* pass a hibernate session to the working memory as a global */ session = factory.openSession(); workingMemory.setGlobal("hibernateSession", session); Login login = new Login();

Re: [rules-users] Call class method from LHS of a rule

2010-03-25 Thread HafeezurRehman
I am using hibernate with drools ... rule "login_validation" when userRole:UserRole() from hibernateSession.createQuery("select userRoles from UserAccount ua where ua.name = :name AND ua.password = :password").setProperties( {"name" : "Hafeez" , "password" : "asdasd" }).

Re: [rules-users] Call class method from LHS of a rule

2010-01-04 Thread Wolfgang Laun
2010/1/4 Esteban Aliverti > Using Wolfgang's inline eval epression, I get the following error: "Cannot > use this in a static context" when compiling the rule. I changed > "this" by "$c" and it works. I don't know why we are in a static context. > > Strange. Most likely the compiler converts the

Re: [rules-users] Call class method from LHS of a rule

2010-01-04 Thread Salaboy
This doesn't work because it not reference anything inside the eval, remember that inside the eval you must write an expression that will be compiled and evaluated in runtime. - Ing. Mauricio Salatino - On Jan 4, 2010, at 11:35 AM, orchid wrote: > > Esteban and Wolfgang, thank you very much

Re: [rules-users] Call class method from LHS of a rule

2010-01-04 Thread orchid
Esteban and Wolfgang, thank you very much !!! -- View this message in context: http://n3.nabble.com/Call-class-method-from-LHS-of-a-rule-tp108383p108465.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list r

Re: [rules-users] Call class method from LHS of a rule

2010-01-04 Thread Esteban Aliverti
Using Wolfgang's inline eval epression, I get the following error: "Cannot use this in a static context" when compiling the rule. I changed "this" by "$c" and it works. I don't know why we are in a static context. The rule that worked for me is: Rule "Rule1" when $c:Cheese(type == "chedar", e

Re: [rules-users] Call class method from LHS of a rule

2010-01-04 Thread Wolfgang Laun
What you need is called "inline eval expression" (see the Drools Expert manual), or an eval conditional element. The first one might be written as: $c:Cheese(type == "chedar", eval( this.existsInShop("shopName") ) ) -W On Mon, Jan 4, 2010 at 12:49 PM, orchid wrote: > > Hi All, > > I'm trying

[rules-users] Call class method from LHS of a rule

2010-01-04 Thread orchid
Hi All, I'm trying to call a class method from the LHS of a rule in the following way: public class Cheese{ private string type; //setters and getters public boolean existsInShop(String shop){ ... return true; } } I would like to call the method "existsInShop" from a rule: Rule