I would go with solution number 2: one session per student. Considering the fact that you are not going to interact with the session too much, I would save it in db and only restore it as needed: a new absence / incident appears, the session for this student is restored with db, the facts are inserted, the rules are fulfilled and the received data is restored status.
The main drawback that I see in this scenario is that creating rules for more than one student is not easy, and you must feed your facts in more than one session. For example, if you want to receive a warning if you have more than 10 students with CRITICAL status in the same class. In this case, a session per class will be sufficient. So, as you can see, you have to decide what is best for you. But no matter which unit you choose (school, class, student), I would recommend the flow of execution that I mentioned earlier to you.
Drools already comes with support for saving databases using JPA. You can get more information about this function here: http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html_single/#d0e3961
The basic idea is that instead of creating your ksessions with kbase.newStatefulKnowledgeSession() you are using a helper class called JPAKnowledgeService . This class will return a StatefulKnowledgeSession wrapper, which will retain its state after each method call. In this class, you will find 2 important methods: newStatefulKnowledgeSession() to create a new ksession and loadStatefulKnowledgeSession() to retrieve an existing session from the database.
Hope this helps,
source share