Drools meets Hibernate
Drools evaluates facts which are present in the working memory. But it can also reason over data stored in a relational database. This can be achieved using for example a Hibernate Session to access a relational database and then creating a query. Objects in the resultset can be reasoned over the same way like facts in the working memory. An article, which describes this is available in English, German and Polish.
Labels: drools, Hibernate, JBoss Rules
14 Comments:
Hi,
It is really excellent idea. But how will this work in case spring managed hibernate session and transaction management.
Please show me some pointers if you have any. Or please e-mail me at ramesh dot mandaleeka at gmail.com
Regards,
Ramesh
Actually this is a Spring/Hibernate question and I'm not too confident to answer it since I haven't tried it. But you're welcome to leave a comment if you find out something interesting.
Cheers.
While this example is good to show how to access facts to external memories. I find it a little bit useless.
Because you have to rewrite all your rules to match the rule constraints in your query. So the engine really does not match anything but your queries.
It would be great if drools will generate the HQL based on the condition part (LHS) and obtain result automagically...
This way you have not to rewrite your rules with SQL/HQL and will work without user intervention. What's great.
But I think that's not possible. Don't you think?
This comment has been removed by a blog administrator.
very nice article.
Hi ! Nice artilce....nut I am getting nul pointer exception. I am using drools 5.4 please help me in this....
Thanks !
Hi ! Nice artilce....nut I am getting nul pointer exception. I am using drools 5.4 please help me in this....
Thanks !
Hi ! Nice artilce....nut I am getting nul pointer exception. I am using drools 5.4 please help me in this....
Thanks !
Hi,
It is a very good article.I want to know how can i use named query in drools-guvnor ,Can you please provide me a example?
Hi,
Its really nice.
But I couldn't get the result from hibernate query. The syntax is correct and there is no parser error.
Kindly help me what could cause this.
Hi,
Below is the query.
For time being i hard coded the student id.While running there is no error. But i couldn't get the values from this query.
$student : Student() from hibernateSession.createQuery("select name from Student where studentId = :studId").setProperties(["studId" : Long.valueOf(553747)]).list()
Plz help me, its urgent.
Thanks in advance.
Thanks,
Rose
Hi,
I got the answer.
wrong:
$student : Student() from hibernateSession.createQuery("select name from Student where studentId = :studId").setProperties(["studId" : Long.valueOf(553747)]).list()
correct:
$student : Student() from hibernateSession.createQuery("from Student where studentId = :studId").setProperties(["studId" : Long.valueOf(553747)]).list()
Thanks.
Nice article, easy to follow
Very helpful article, there aren't many articles regarding this topic.
I have saved all my Drools facts data in SQL via Hibernate, however, every time, when I start my application, Drools has to load my entire database into memory which will take multiple hours to load, I can see Hibernate is doing select statements during loading the Drools session. This application is not useful because of this.
I wonder if there is a way to configure to avoid this. Any idea will be helpful.
Thanks a lot.
Post a Comment
Subscribe to Post Comments [Atom]
<< Home