[rules-users] Override JPAWorkItemManager

Amin Mohammed-Coleman aminmc at gmail.com
Wed Sep 7 11:11:11 EDT 2011


Hi 

Thanks for your reply. I am trying to replace the JPAWorkItemFactory so I can do some custom work. There is supposed to be some API that you can use but I can't find this. 

Cheers
Amin

Sent from my iPhone

On 7 Sep 2011, at 14:56, Alexander Egger <alexander.egger at gmail.com> wrote:

> Hi,
> 
> I am working on the same problem currently. You can use your own
> PersistenceContext using the following code.
> 
> TransactionManager transactionManager =
>        new TransactionManagerFIVE();
>    Environment env = KnowledgeBaseFactory.newEnvironment();
>    env.set(EnvironmentName.TRANSACTION_MANAGER, transactionManager);
>    env.set(EnvironmentName.PERSISTENCE_CONTEXT_MANAGER,
>        new ProcessPersistenceContextManagerFIVE());
>    return env;
> 
> Having my own PersistenceContext is enough for me as you have access
> to all persistence methods and I am implementing my own persistence
> layer from there.
> 
> This is not exactly an answer to your question but maybe it helps.
> 
> Alexander
> 
> 2011/9/7 Amin Mohammed-Coleman <aminmc at gmail.com>:
>> Hi
>> Thought it would make sense to show some code:
>> Properties prop = new Properties();
>> ...
>> prop.put("drools.workItemManagerFactory",
>> CustomJPAWorkItemManagerFactory.class.getName());
>> KnowledgeSessionConfiguration config = KnowledgeBaseFa
>> ctory.newKnowledgeSessionConfiguration(prop);
>> JPAKnowledgeService.newStatefulKnowledgeSession(..,config,..);
>> 
>> The default JPAWorkItemManager factory is picked up every time. This is due
>> to the session configuration containing 2 factories and the default is being
>> pickedup.
>> Any help would be appreciated.
>> Cheers
>> 
>> Sent from my iPhone
>> On 7 Sep 2011, at 04:58, Mauricio Salatino <salaboy at gmail.com> wrote:
>> 
>> are you sure that the property is being set in the right place? I always
>> have troubles doing that. Did you try setting it up using the APIs? Just to
>> see if your work item works?
>> Cheers
>> 
>> 2011/9/6 Amin Mohammed-Coleman <aminmc at gmail.com>
>>> 
>>> Hi
>>> 
>>> 
>>> 
>>> I am trying to set a custom jpa work item manager and setting it on the
>>> properties object before i create a knowledgesessionconfiguration with
>>> property "drools.workItemManagerFactory" but it seems as though the default
>>> JPAWorkItemManager is used every time.  Is there a way to override this?
>>> 
>>> 
>>> 
>>> Cheers
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>> 
>> 
>> 
>> 
>> --
>>  - CTO @ http://www.plugtree.com
>>  - MyJourney @ http://salaboy.wordpress.com
>> - Co-Founder @ http://www.jugargentina.org
>>  - Co-Founder @ http://www.jbug.com.ar
>> 
>>  - Salatino "Salaboy" Mauricio -
>> 
>> _______________________________________________
>> 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
>> 
>> 
> 
> _______________________________________________
> 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