Thought to share new development on this issue.  The use case I have is where I 
needed just 1 global SessionInfo - and don't need any update. I didn't wanted 
to associate the process instance with SessionInfo and store this association 
somewhere else. This is what I did to resolve the issue.


a)      Create an extension class for "SingleSessionCommandService" so that the 
"lastModificationDate" is not updated when the process execution operation 
ends. This will make sure the SessionInfo doesn't gets dirty for my use case.

b)      Created an extension class for JPAKnowledgeServiceProviderImpl - to set 
the above single session extension class.

c)       Created an extension class for JPAKnowledgeService to set the above 
extension class of  JPAKnowledgeServiceProviderImpl.

d)      So whenever the application starts - it always checks if the single 
record for SessionInfo is present or not - and if not the same is created 
through JPAKnowledgeService.

e)      Upgraded the Hibernate to 3.5.1 which implements JPA 2.0 - that now 
provides cache functionality at EntityManagerFactory level - similar to second 
level cache functionality

f)       Configure the SessionInfo.class to be set at 2nd level cache with the 
cache set as "read-only".

The above changes gave me what I was looking for - a global read only 
SessionInfo --- where unnecessary read does not happen on SessionInfo and nor 
any update on it and only 1 record for SessionInfo .

Cheers
Vijay

From: Vijay K Pandey
Sent: Monday, April 19, 2010 4:12 PM
To: rules-users
Subject: Drools Flow - Latest Snapshot vs 5.1.M1 - JPA - SessionInfo issues

Hi,

Has the working of the "SessionInfo" changed from 5.1.M1 vs latest snapshot 
(18th Apr 2010).  I am using the JPA persistence to store the process instance 
along with the Human Task related data. What I noticed is that "SessionInfo" is 
getting updated whenever I execute the operation through the 
"SingleSessionCommandService"

public synchronized <T> T execute(GenericCommand<T> command) ---- this always 
leads to an update on "SessionInfo", in 5.1.M1 it was not the case.

My use case is where I want to have only 1 global kind of session as I don't 
store any state in the session - it's just there to load any process instance - 
now due to update(always) on the sessionInfo, won't there be concurrency issues 
( as 'optlock' column is always changing - I guess it's there for optimistic 
concurrency check)  as multiple process instances are being worked upon (the 
SQL for update that gets executed is).

update
        SESSION_INFO    set  
last_modification_date=?,rules_byte_array=?,start_date=?,optlock=?     Where 
id=? and optlock=?

I don't need multiple SessionInfo - is there a way to achieve this?

Thanks
Vijay
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to