Rukas - Oh, My Blog!

导航

<2012年6月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

公告

我用心祈祷
神终于感动了
神问我的愿望是什么
我说要和你做一生的朋友
神说不行
只能七天
我说好
星期一到星期七
神说不行
只能四天
我说好
春天 夏天 秋天 冬天
神说不行只能三天
我说好
昨天 今天 明天
神说不行
只能两天
我说好
白天 夜天
神又说不行
只能一天
我说好
在我活者的每一天
最后神哭了
我笑了

留言簿(27)

随笔分类(55)

随笔档案(59)

阅读排行榜

评论排行榜

友情链接

最新评论

Using Hibernate Synchronizer 3 with Spring and Hibernate 3

http://www.supergloo.com/tmblog/2005/11/using-hibernate-synchronizer-3-with.html

Thursday, November 10, 2005

Using Hibernate Synchronizer 3 with Spring and Hibernate 3

Popular question on Hibernate Synchronizer forum involves using it with Spring. Here's one way:

The following steps assume you have already installed the Hibernate Synchronizer in Eclipse:

1) Update the Hibernate Synchronizer to use a custom base root (Click Here for Source Code)

From Menu bar: Project->Properties->Hibernate Synchronizer->Data Access Objects tab->Check "I would like to use a custom root" and enter full path to the SpringBaseRootDAO

2) Update the Hibernate Synchronizer to use a custom Exception class
Same location as above. Enter "org.springframework.dao.DataAccessException" for DAO Exception input box

3) Update Base DAO Snippets
a) On Eclipse Menu bar, click Window->Preferences
b) Click Hibernate Synchronizer on left panel
c) Click Snippets
d) Expand Base DAO
e) Replace Action Methods with this
f) Replace Finder Methods with this
g) Replace Imports with this
h) Replace Required Methods with this

(I removed JRE 1.5 specific content from snippets)

4) Configure your generated DAO(s) to inject a LocalSessionFactory for HibernateTemplate's "sessionFactory" property (SpringBaseRootDAO extends HibernateTemplate). For example, an entry in the applicationContext.xml might look like:

<bean id="usersDataAccessObject" class="com.xyz.data.dao.UsersDAO">
<property name="sessionFactory">
<ref local="mySessionFactory"/>
</property>
</bean>

Of course, the above example assumes you have "mySessionFactory" bean defined.

Hope this helps. Comments welcome.

posted on 2005-11-23 21:35 Rukas - Oh, My Blog! 阅读(964) 评论(1)  编辑 收藏 引用 所属分类: Hibernate

评论

# re: Using Hibernate Synchronizer 3 with Spring and Hibernate 3 2008-01-07 23:07 sdfsdf

sdfsd  回复  更多评论   

只有注册用户登录后才能发表评论。