[rules-users] Can't obtain object from a FactHandle

Wolfgang Laun wolfgang.laun at gmail.com
Sat Mar 2 13:10:16 EST 2013


Further investigation has shown me that, with the given LHS scenario,
   session.getFactHandle(Object obj)
is capable of giving me the correct fact handle value even for the
facts being passed through a "from".

This leads me to think that the useless FactHandle values returned by
getFactHandles() are due to a bug (and not so by design).

-W


On 02/03/2013, Wolfgang Laun <wolfgang.laun at gmail.com> wrote:
> Given a
>    org.drools.event.rule.BeforeActivationFiredEvent,
> method getActivation() returns a
>    org.drools.runtime.rule.Activation
> and its method getFactHandles() is documented to return a List<FactHandle>.
>
> It should be possible to retrieve the fact object using
> session.getObject( factHandle ), and this succeeds in many instances,
> but not reliably (5.5.0-Final).
>
> Given facts of types One and Two a rule like
>    One( $list: listOFTwos )
>    Two(...) from $list
> I find that Two facts, when matched via from, are not reported with
> the proper fact handle, i.e., the one returned from the insert.
>
> What's the point in reporting fact handles that can't be used to
> retrieve a fact object?
>
> If I want to obtain all facts that participate in an activation, is
> method Activation.getObjects() more (and fully) reliable?
>
> -W
>


More information about the rules-users mailing list