2012-06-12 37 views
0

經過漫長的谷歌我無法找到任何Spring Web流與Hibernate示例Example.Can任何人幫助我簡單的Spring Web流example.I需要創建一個登錄表單與Spring Web流。現在我仍然熟悉Spring web流程。如果使用Hibernate連接到數據庫的任何示例應用程序(如登錄表單)將會很有幫助。春季Web流與休眠

回答

1

如果你不能找到示例代碼是不是太難的設置,SWF只是一個控制器,並註冊在Spring MVC與一些性能控制器:

<!-- 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> 

一旦你有你只需要像使用其他MVC應用程序一樣使用Hibernate。也許你會對使用FlowScoped PersistenceContext感興趣,這使得SWF能夠管理你的域對象(http://static.springsource.org/spring-webflow/docs/2.3.x/reference/html/ch07s02.html)。

請考慮閱讀SWF官方文檔(http://static.springsource.org/spring-webflow/docs/2.3.x/reference/html/index.html)。

0

集成Hibernate和Spring Web流程不是一件困難的事情。它和Spring MVC一樣。只需編寫Hibernate配置文件.Call Service層,在服務層調用各自的DAO。 DAO將與數據庫進行交互。

+0

這是對用戶問題的相當晚的回覆,您應該嘗試使用英語更清晰。 – simonmorley