Are your EJB3 beans merely JPA annotated, or state(full\less) session beans?

Drools can create new instance of JPA annotated beans, as there's simply
POJOs however if for stateful\stateless session beans your contain will
handle life-cycle.

The associations you describe are part of your domain model and therefore
Drools rules can achieve what you describe. Here's a simple example:-

rule "ensure all documents have a summary line"
when
    $d : Document( )
    not Line( document == $d, lineType == "summaryLine" )
then
    Line newLine = new Line();
    newLine.setDocument( $d );
    insert(newLine);
end

Your exact implementation will depend upon your object model.

With kind regards,

Mike

2011/2/19 Thomas Adler <[email protected]>

>  Hi,
>
> I am trying to use Drools and I would like to check whether such scenario
> could work:
> I have facts Document and Line (EJB3 beans, in fact). And Document class
> has attribute:
> List<Line> lines
>
> So - I would like to pass to stateless session a Document instance
> "document" and I would like to write rule, that
> 1) create some new Lines;
> 2) calculates total from lines;
> 3) updates document.total;
> 4) add new Lines instances, that where created during the rule execution to
> document.lines;
> And at the end of execution of this session I will like to do some other
> things with document and document.lines, e.g. persist in database.
>
> So - can Drools handle such create of associations during the session
> execution?
>
> Thanks!
> Thomas
>
> _______________________________________________
> rules-users mailing list
> [email protected]
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to