Hi believe that I have found the answer, but it is only available in the new 3.1M1
release, right?
Answer:
'from'
*
http://jira.jboss.com/jira/browse/JBRULES-341
'from' allows the engine to reason over data not inside the engine, this can be
used with global variables to interact with data providing services, such as hibernate.
MVEL provides the scripting language capabilities for this, any previously bound variable
can be used in the MVEL expression. The following example shows a hibernate named query
with some dummy properties that returns a list of Restaurants. Restaurant() is a standard
pattern, and can have its own field constraint and bindings like any other pattern.
$r : Restaurant( $postCode ) from hbSession.getNamedQuery( "some query"
).setProperties( [ key1 : value2, key2 : value ] ).list()
__________________________________
Francisco Brum - francisco.brum(a)link.pt <mailto:rui.arrenega@link.pt>
Link Consulting -
http://www.link.pt/ <
http://www.link.pt/>
Tel.: 213 100 031
Av. Duque D'Ávila, 23 4º Esq.
1000-138 Lisboa
________________________________
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On
Behalf Of Francisco Brum
Sent: terça-feira, 27 de Fevereiro de 2007 15:03
To: Rules Users List
Subject: [rules-users] accessing the data base
Hi everybody!
I would like to be able to access the data base during the execution of a rule.
The reason it's because instead of asserting in the working memory information as a
global, it would be easy to make a SQL query using hibernate to consult the information.
Can I implement this in a function of my global fact or there is another way?
Thanks in advance for your attention!
__________________________________
Francisco Brum - francisco.brum(a)link.pt <mailto:rui.arrenega@link.pt>
Link Consulting -
http://www.link.pt/ <
http://www.link.pt/>
Tel.: 213 100 031
Av. Duque D'Ávila, 23 4º Esq.
1000-138 Lisboa