you have to close the context
The JbpmTemplate which gets from Spring Module responsible for closing the context,so it's not expressed in my code snippet.
Now i extend the OpenSessionInView filter which gets form the Spring framework,overridding the closeSession method which flush the session each time the request completed.And this sovled the problem.
But since we can't depend on non-transactional behaviour,can you give me a better solution.
BTW:I don't know why can't flush the session in the HibernateTemplate.
I think you should ask in the spring-jbpm forum as well. None of these spring templates is used by us so the developers of those are more experienced than I am/we are with this.
Sorry I cannot be of more help, maybe others (even in this forum) have a clue, but I don't.
What you can try is to turn on debug of hibernate and and/or the spring templates and check if an insert is done.