views:

832

answers:

1

Hello.

My team and I are currently starting up a project using Spring 2.5.6 and Spring Webflow 2.0 (JDK 1.4.2). We're in the design phase right now, and I would like to know whether or not Spring's Persistence context/entity manager (we're going to use Hibernate) can commit from subflows.

The commit attribute is only available from the end-state. So, if we have a flow like this:

<flow>
<persistence-context />
<!-- Do some things -->
<!-- Call a subflow.  This hopefully will commit stuff. -->
<subflow-state id="foo">
</subflow-state>
<!-- Do some more things -->
<end-state id="theEnd" commit="true" />
</flow>

<!-- The Subflow -->
<flow>
<persistence-context />
<!-- Do some things -->
<!-- Do some more things -->
<end-state id="theEnd" commit="true" />
</flow>

We would like the subflow to be able to commit its steps prior to the complete execution of the parent flow. Hopefully it can.

Will the subflow be able to commit? Or will webflow prohibit this and only let the true parent flow commit to the database with its entity manager/persistence context?

A: 

Ok, so, the answer is, yes and no. The subflow is actually allocated a different persistence context than its parent, and it can use that persistence context to commit, but if the technology in use is Hibernate, the objects have to be attached to its session before the commit end state is issued.

MetroidFan2002