[rules-users] question on syntax with FROM keyword

Eric Miles eric.miles at kronos.com
Fri Nov 2 14:25:39 EDT 2007


That works, thanks a bunch.  However, the exists still will not work as
I had hoped.  The brackets do not help if dao.find(99) returns a null; I
receive a null pointer exception.  Is there any way to deal with that
gracefully in drools?  That's why I wanted to use the exists syntax...

exists (SomeObject(val == "5") from dao.find(99))


Thanks!
Eric


On Fri, 2007-11-02 at 17:19 +0000, Mark Proctor wrote:
> put brackets around the SomeObject and from statement
> not ( SomeObject(val == "5") from dao.find(99) )
> 
> Eric Miles wrote:
> > I'm trying to use the FROM keyword in a way that I think it should be
> > able to be used, but I'm getting compilation errors.  Here are the 2
> > ways that I'm getting stumped on:
> >
> > exist SomeObject(val == "5") from dao.find(99)
> >
> >
> > and
> >
> > not AnotherObject(val == "Dad") from anotherDao.find(1)
> >
> >
> > If I remove the exist and not, everything compiles okay.  With the first
> > test, I'd like to ensure an object exists AND it has a value of 5.
> > dao.find could return a null, so I don't want the test to crap out
> > because of a NullPointerException.
> >
> > With the second one, I want to ensure the collection returned from
> > anotherDao.find call does not have an AnotherObject instance with a
> > value of "Dad".
> >
> > These seem like fairly trivial things to test for, so I'm fairly certain
> > there's an appropriate way to structure these test.  Any help is
> > appreciated.
> >
> > Thanks all.
> >
> > Eric
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >   
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users



More information about the rules-users mailing list