Re: [rules-users] How to write Hibernate query lang(HQL) in .DRL file
Hi, please visit the below link http://magazine.redhat.com/2008/07/11/jboss-drools-meets-hibernate/ Thanks, Abhinay -- View this message in context: http://drools.46999.n3.nabble.com/How-to-write-Hibernate-query-lang-HQL-in-DRL-file-tp4018571p4023747.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How to write Hibernate query lang(HQL) in .DRL file
Hi, I do have the same issue. I need to use Hibernate in Drools to Query the DB. In Java code, I was successful in using Hibernate Native SQL. In DRL, I have the Hibernate session, how to use it for performing NativeSQLQuery i.e, Sample() from hibernateSession.createSQLQuery("Quering some table and retrieving some column values").list() Sample() is the class corresponding to columns which are retrieved from Query. Please suggest the good solution. Thanks in advance. -- View this message in context: http://drools.46999.n3.nabble.com/How-to-write-Hibernate-query-lang-HQL-in-DRL-file-tp4018571p4023730.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How to write Hibernate query lang(HQL) in .DRL file
If you have working Java code import a.b.MyService; MyService service = ...; service.aMethod(...); then in DRL you can do import a.b.MyService; global MyService service; rule x when ... then service.aMethod(...); end and in your Java code, after you create the session and before you fire any rules you must assign an object to the global: MyService service = ...; kSession.setGlobal( "service", service ); That's all. -W On 11/07/2012, ashwindrool wrote: > Hi Laune, > > We are tried to created similar scenario in which we get error when we > tried > to execute HQL from DRL file but unfortunately , i m sorry we r unable to > give you exact what error we are getting. > > But it will be great if you can share your approach or process in calling > hibernate query directly in DRL file. > How to pass hibernate session and execute query if we can run simple > select query from their , then we can go for complex nested queries. > > -- > View this message in context: > http://drools.46999.n3.nabble.com/How-to-write-Hibernate-query-lang-HQL-in-DRL-file-tp4018571p4018580.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How to write Hibernate query lang(HQL) in .DRL file
Hi Laune, We are tried to created similar scenario in which we get error when we tried to execute HQL from DRL file but unfortunately , i m sorry we r unable to give you exact what error we are getting. But it will be great if you can share your approach or process in calling hibernate query directly in DRL file. How to pass hibernate session and execute query if we can run simple select query from their , then we can go for complex nested queries. -- View this message in context: http://drools.46999.n3.nabble.com/How-to-write-Hibernate-query-lang-HQL-in-DRL-file-tp4018571p4018580.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How to write Hibernate query lang(HQL) in .DRL file
But you can write plain Java code in any consequence, in DRL. What "errors"? -W On 11/07/2012, zeeshan wrote: > Hi ! > > According to my requirement I need to fetch and Insert data from database > using Hibernate Query from .DRL file. > I have idea how to execute HQL in Plain Java class but according to my > requirement,I need to fire query to database from .DRL file which I tried > but unable to get output instead I was getting errors. > > Can anyone suggest me process to execute Hibernate Query from DRL > file > or please provide me some sample code or any link. > > Thanks !! > > -- > View this message in context: > http://drools.46999.n3.nabble.com/How-to-write-Hibernate-query-lang-HQL-in-DRL-file-tp4018571.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] How to write Hibernate query lang(HQL) in .DRL file
Hi ! According to my requirement I need to fetch and Insert data from database using Hibernate Query from .DRL file. I have idea how to execute HQL in Plain Java class but according to my requirement,I need to fire query to database from .DRL file which I tried but unable to get output instead I was getting errors. Can anyone suggest me process to execute Hibernate Query from DRL file or please provide me some sample code or any link. Thanks !! -- View this message in context: http://drools.46999.n3.nabble.com/How-to-write-Hibernate-query-lang-HQL-in-DRL-file-tp4018571.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users