bharathi
bharathi

Reputation: 6271

Spring Web Flow with Hibernate

After a long google I am not able to find any Spring Web flow with hibernate sample Example.Can anyone Help me with simple Spring Web flow example.I need to create a Login Form with Spring web flow.Still now I am now familiar with the Spring web flow.If any sample application like Login form which connects to database using Hibernate will be helpful.

Upvotes: 0

Views: 1045

Answers (3)

Evandro Brunassi
Evandro Brunassi

Reputation: 89

You need to configure your hibernate properties normally (with the @ annotations which references the table, etc). Dont forget to make the '@Service' annotation in your DAO. After that, you just need to go to the xml file that controls your flows, and add the DAO's functions.

Upvotes: 0

Harish Kadamudi
Harish Kadamudi

Reputation: 127

Integrating Hibernate and Spring Web flows in not a difficult task.It's as same as Spring MVC. Just write Hibernate configuration file.Call Service layer, In the service layer just call respective DAO's. Where DAO's will be interacting with the Database.

Upvotes: 0

If your are not able to find sample code is not too difficult to setup, SWF is just a controller and is registered in Spring MVC as a controller with some more properties:

<!-- Creates a flow executor in Spring, responsible for creating and executing flows -->
<flow:flow-executor id="flowExecutor" flow-registry="flowRegistry" />

<!-- Load flow definitions and make them available to the flow executor -->
<flow:flow-registry id="flowRegistry">
    <flow:flow-location id="process-flow" path="/process/flows/process-flow.xml" />
</flow:flow-registry>

<!-- The FlowHandlerMapping helps DispatcherServlet to knowing that it should send flow requests to Spring Web Flow -->
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
    <property name="flowRegistry" ref="flowRegistry" />
</bean>

<!-- The FlowHandlerAdapter is equivalent to a Spring MVC controller in that it handles requests coming in for a flow and processes those requests -->
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter">
    <property name="flowExecutor" ref="flowExecutor" />
</bean>

Once you have you just have to use Hibernate the same way as you would do with any other MVC app. Perhaps you would be interested on using FlowScoped PersistenceContext, that makes SWF able to managing your domain objects (http://static.springsource.org/spring-webflow/docs/2.3.x/reference/html/ch07s02.html).

Consider reading the SWF official documentation (http://static.springsource.org/spring-webflow/docs/2.3.x/reference/html/index.html).

Upvotes: 1

Related Questions