Persist JPA Entity fact in session
by Alberto R. Galdo
Hi,
We are in a fireUntilHalt during a persistent StatefulKnowledgeSession
using JTA & JPA with Hibernate ... Our session consists in a series of
facts ( well, we are not different of anyone else for that matter ... xD )
but some of our facts are also JPA @Entity . What we want is to persist
those entities on their own database tables as well as the SessionInfo each
time Drools considers the knowledge session needs to be persisted.
We are aware that Drools uses
org.drools.persistence.jpa.persist(SessionInfo) .... What would be the best
approach to get certain facts that are JPA Entities persisted along with
the Session taking advantage of the Drool's SessionInfo persistence loop?
Best regards,
Alberto R. Galdo
argaldo(a)gmail.com
13 years, 9 months
[Designer] Problem installing service from repository
by Cristiano Gavião
Hi,
I'm using Designer 2.2 with Guvnor 3.4 in a Jboss AS 7.1.
I could connect to this service repository url:
http://people.redhat.com/kverlaen/repository in the Designer editor.
I've selected the Twitter service but I got this error:
19:58:58,896 ERROR
[org.jbpm.designer.web.server.JbpmServiceRepositoryServlet]
(http--127.0.0.1-8080-5) Could not find the package for uuid:
c3142f2a-084b-423f-8afa-640c84140075
Am I missing something ?
regards,
Cristiano
13 years, 9 months
[5.4.0] Combining custom operators with OR results in compile error
by Stathis Rouvas
Hello List,
I recently migrated from Drools.5.0.1 to Drools.5.4.0 and I am having issues when combining constraints with OR when custom operators are involved.
For example, the following rule:
rule "r548695.1"
no-loop true
dialect "mvel"
when
gnId : GN()
la : t547147( )
v1717 : Tra48( gnId.gNo==gNo , name F_str[startsWith] la.c547148 || postCode F_str[contains] la.c547149 )
then
System.out.println("Rule r548695.1 fired");
end
results in the following exception:
Unable to Analyse Expression gnId.gNo == gNo && ( F_str0.evaluate( name, la.c547148 ) || F_str1.evaluate( postCode, la.c547149 ) ):
[Error: unable to resolve method using strict-mode: my.package.rulez.Tra48.F_str0()]
[Near : {... gNo == gNo && ( F_str0.evaluate( name, la.c54 ....}]
^ : [Rule name='r548695.1']
Please note, that the same rule using AND (&&) between the custom operators compiles OK.
The above rule had not problem whatsoever in Drools.5.0.1.
Any ideas to overcome this issue, are most welcomed.
-Stathis
13 years, 9 months
Drools function not working with Javassist facts
by Ayush
Hello,
I'm trying to build a rule which accepts the dynamic facts. The dynamic
facts are created using the javassist API. The rule works fine when I'm
adding a single rule but as soon as I declare any function in the drl file
the rule doesn't compile.
*Following is the code sample for creating the dynamic facts.*
// creating class object
final ClassPool pool = ClassPool.getDefault ();
CtClass evalClass = pool.makeClass ("drools.dynamic.MyDynamicClass");
// creating class field
final CtField nameField = new CtField (CtClass.intType, "Count",
evalClass);
nameField.setModifiers (Modifier.PRIVATE);
evalClass.addField (nameField);
// creating getter for the above created field.
final CtMethod getter = CtNewMethod.getter ("getCount", nameField);
evalClass.addMethod (getter);
// creating setter for the above created field.
final CtMethod setter = CtNewMethod.setter ("setCount", nameField);
evalClass.addMethod (setter);
// finally creating class
final Class tempClass = evalClass.toClass ();
// creating class object
Object obj = tempClass.newInstance()
// inserting it in drools
droolsSession.insert(obj)
*Following is the rule *
rule "DynamicFactRule"
dialect "mvel"
when
$obj : MyDynamicClass()
then
$obj.setCount(8);
System.out.println("Count set is: "+$obj.getCount(8));
end
*This rule works fine but when I'm adding a function in drl file then it
throws error: *
1) Unable to resolve ObjectType 'MyDynamicClass'
2)Error importing : 'defaultpkg.LogMessage.logMessage'
*The function I added is*
function void logMessage() {
System.out.println("This is log message");
}
*Following is the environment I'm using*
- Drools 5.3.0
- JBoss 6.x
- JDK6
I looked at many approaches but I'm confused and out of soln, as none of it
is working. I also tried looking at Drools trait but it's going over my head
I'll highly appreciate if someone can please suggest what should be the
ideal approach to solve it.
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-function-not-working-with-Javass...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 9 months
How to use Guvnor effectively?
by mpgong
Hello,
I have a feeling that i'm not using guvnor correctly. My issue is that when
i use the knowledge agent to load a package from guvnor it takes just as
long to get the knowledge base as it does if i were to use the knowledge
builder and add rules resources. So when i do a build package in guvnor it
does compile everything and the binary that is created is what would end up
if i were to use the knowledge builder?
In the past i would rebuild the knowledge builder but i switched to guvnor
because i thought it would be easier to rebuild and manage plus getting the
knowledgebase to be faster. I'm i wrong in my understanding?
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-use-Guvnor-effectively-tp4006811...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 9 months