ShadowProxy & PersistentSet
by vdelbart
Hi,
I have a big problem with shadowproxy.
All my objects are hibernate so they use PersistentSet in their properties.
But when the shadowproxyfactory clone the PeristentSet properties, I have
this error :
org.hibernate.LazyInitializationException: failed to lazily initialize a
collection, no session or session was closed
I temporaly use shadowproxy=false and it's working but I'm not sure it is a
good idea. (I try
drools.shadowProxy.Exclude=org.hibernate.collection.PersistentCollection it
doesn't work because I don't use directly the class in the working memory)
maybe somebody have a tip ?
thanks,
V.
--
View this message in context: http://www.nabble.com/ShadowProxy---PersistentSet-tp16824934p16824934.html
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 7 months
Shadow Facts & update
by vdelbart
Hello,
for hibernate reason I disable shadow facts; however I have 'update' like
this :
rule "eeeee"
when
...
then
obj.attr = "other";
update(obj);
end
and I can confirm, I have an "unpredictable behavior".
Could I replace this sentence by this :
rule "eeeee"
when
...
then
retract(obj);
obj.attr = "other";
insert(obj);
end
thanks for your help,
V.
--
View this message in context: http://www.nabble.com/Shadow-Facts---update-tp16939699p16939699.html
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 7 months
When is eval unavoidable?
by Bagwell, Allen F
I'm learning how to use Drools, but eval presents a problem to me when I am composing rules. I've read the manual and have a basic understanding of what it is for (very useful in certain situations!), but is there a better explanation of when it cannot be avoided?
For example when writing the LHS portion of a rule, I've run into a problem where literal restrictions alone are fine for one object but inadequate for another. Like so:
$a : X(temp < 100)
$b : Y(running == true)
In both cases class X and class Y have standard Java bean set up for these fields with appropriate getters and setters, and the corresponding inserted facts see these fields being updated from time to time. But whereas the first fact causes rule activation when the temp field meets the rule critiera, the second will never work unless it is re-written as:
$b : Y()
eval ($b.isRunning() == true)
I've encountered a similar problem with in-line evals where Drools will accept an LHS like this:
// attempting to find all applicants named Bob
$p : Person(firstName == "Bob")
$ap : Applicant(person == $p)
but it will never cause activation unless you re-write it like this:
$p : Person(firstName == "Bob")
$ap : Applicant( eval(person == $p) )
despite the fact that the Applicant object's person field once set never changes.
So is there a more definitive explanation as to why one is forced to use eval when you would think that simple literal restrictions would be enough? I've read in other posts that "eval is evil" and to best avoid it unless necessary, but this is perplexing me because I haven't yet discovered the way to think about rule composition that prevents eval use from appearing to be arbitrary. Mostly it's been write what I think *should* work and if it does then great, it if doesn't then keep adding evals until it does. For the record, I'm using the java dialect if that makes a difference.
Thanks!
-Allen
16 years, 7 months
RE: Drools Tomcat
by Hehl, Thomas
Please direct your e-mails to the list and I will respond if I can.
I have used both tomcat 5.5 and tomcat 6 with Drools 4.x (4.04 I think) and
it was completely transparent. I haven't published any advice, although I
think the docs are a little lacking on decision tables, which is primarily
how we're using drools. I simply haven't had time to augment them
appropriately.
Decision tables error messages also seem a little cryptic and I've mostly
found solutions to problems by reading the rule again and guessing about
what the problem is.
Alas, nothing is perfect, but once you get your decision table set up,
drools runs REALLY sweet!
Good luck.
-----Original Message-----
From: skirtane(a)paypal.com [mailto:skirtane@paypal.com]
Sent: Friday, April 25, 2008 5:29 PM
To: Thomas.Hehl(a)acs-inc.com
Subject: Drools Tomcat
HI,
Have you successfully installed drools with tomcat ? Do you any pointers or
instructions published on any website ? What veriosn of tomcat did work for
you ? tomcat 5.5 or 6.0 ?
16 years, 7 months
MissingPackageName Exception | Eclipse | brl to drl
by vmuthupal
Hi,
We created a brl rule using guided editor in Eclipse 3.3
On trying to create a rule package we are getting a 'MissingPackageName'
exception.
As like a brl rule created in BRMS, on eclipse, the DRL source of the
created brl shows only the rule body `with the exception of the package
statement and imports. Our understanding is that packagebuilder in
drools-compiler should pick the package name and the imports defined in the
rules.package text file.
Things work fine for business rules created in guided editor in BRMS. Are we
missing something obvious here? or there isn't a way to compile and test the
brl files created in Eclipse. Any inputs are highly appreciated. Thanks.
Code snippet fyi
File file = new File(test_brl);
BRXMLPersistence read = (BRXMLPersistence)
BRXMLPersistence.getInstance();
BRDRLPersistence write =
(BRDRLPersistence)BRDRLPersistence.getInstance();
String brl = FileUtils.readFileToString(file);
String outputDRL = write.marshal(read.unmarshal(brl));
System.out.println("outputDRl"+outputDRL);
//Output DRL here doesn't show the import statements
and package name
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl(new StringReader(outputDRL
)); //Missing package name for rule package exception occurs here
Package pkg = builder.getPackage();
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage( pkg );
WorkingMemory workingMemory = ruleBase.newStatefulSession();
workingMemory.insert(obj);
workingMemory.fireAllRules();
--
View this message in context: http://www.nabble.com/MissingPackageName-Exception-%7C-Eclipse-%7C-brl-to...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 7 months
"contains" operator for collections as facts?
by Raffi Khatchadourian
Hi. I understand that the "contains" operator works as follows (from the
drools manual):
>'contains' is used to check if a field's Collection or array contains
>the specified value.
However, what if the fact itself is a collection and I want to know
whether or not that collect contains an item? For example, say I had an
ArrayList instance inserted as a fact in the rulebase and in one of my
queries my predicate is to express that that ArrayList instance contains
a certain object. Any ideas? Thanks!
Raffi
16 years, 7 months