Announcement Announcement Module
No announcement yet.
Spring Data Jpa breaks JpaFlowContextPersistence Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Data Jpa breaks JpaFlowContextPersistence


    I've already posted a related thread about this (!), however i already found what the problem is:

    Spring Data Jpa Repositories breaks JPA Flow Persistence.

    The problem is that if i call directly a Jpa Repository in the flow, for some reason, the model entity is saved into the Database not following the JpaFlowExcution pattern.

    So, if you have:

            <persistence-context />
    	<view-state id="edit" model="xpto">
    		<transition on="back" to="cancelEdit" bind="false" validate="false" />
    		<transition on="save" to="endSave">
    			<evaluate expression="" />
                    <transition on="test" to="edit">
    			<evaluate expression="xptoFlowService.someRandomMethod()" />
    			<evaluate expression="fooJpaRepository.count()" />
    	<end-state id="cancelEdit" commit="false" />
    	<end-state id="endSave" commit="true" />
    On test transition, the model is persisted into the database. Just remove:
    <evaluate expression="fooJpaRepository.count()" />
    and everything runs as expected.

    I'm really stuck in this issue, and i would be very thankfull if anyone could help me. If spring data jpa repositories cannot be used inside the Webflow, this will be a big pitfall and i will be forced to give up spring data jpa

    I'm using Spring Data 1.1.0 with Spring Webflow 2.3.1 and JPA 2.0.

    Thanks in advance.

    Best Regards

  • #2
    I believe i have found some clues about my behaviour: