Not sure I understand your question, but are you saying that your database contains more tasks then you would be expecting? In this case, it contains tasks that we're created in a previous session but which are still there, even though you terminated the session (which seems to make sense to me, as terminating a session / process does not remove the tasks)?
Could you maybe share your process and a simple test case that shows this behavior so I can reproduce?
Thanks Kris for looking into this. Please find attached project source code. I am running the "JPAPersistProcessTest.java" program. once the process is completed successfully, i am terminating the program and relaunching it. once we relaunch the program, it is creating task for a prior session.
I found issue in my code. I was closing the session before CommandBasedHumanTaskHandler was updating the process instance details in database. Its working fine now. but I found another issue in process execution itself (how Gateway diverge and Gateway converge works in jBPM). I will create a separate discussion thread for that.