﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-Rukas - Oh, My Blog!-随笔分类-Hibernate</title><link>http://www.cnitblog.com/rukas/category/1380.html</link><description /><language>zh-cn</language><lastBuildDate>Mon, 26 Sep 2011 14:53:27 GMT</lastBuildDate><pubDate>Mon, 26 Sep 2011 14:53:27 GMT</pubDate><ttl>60</ttl><item><title>Hibernate Synchronizer 网址</title><link>http://www.cnitblog.com/rukas/archive/2005/11/23/4857.html</link><dc:creator>Rukas - Oh, My Blog!</dc:creator><author>Rukas - Oh, My Blog!</author><pubDate>Wed, 23 Nov 2005 14:10:00 GMT</pubDate><guid>http://www.cnitblog.com/rukas/archive/2005/11/23/4857.html</guid><wfw:comment>http://www.cnitblog.com/rukas/comments/4857.html</wfw:comment><comments>http://www.cnitblog.com/rukas/archive/2005/11/23/4857.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/rukas/comments/commentRss/4857.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/rukas/services/trackbacks/4857.html</trackback:ping><description><![CDATA[<A href="http://hibernatesynch.sourceforge.net/">http://hibernatesynch.sourceforge.net/</A><img src ="http://www.cnitblog.com/rukas/aggbug/4857.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/rukas/" target="_blank">Rukas - Oh, My Blog!</a> 2005-11-23 22:10 <a href="http://www.cnitblog.com/rukas/archive/2005/11/23/4857.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Using Hibernate Synchronizer 3 with Spring and Hibernate 3 </title><link>http://www.cnitblog.com/rukas/archive/2005/11/23/4855.html</link><dc:creator>Rukas - Oh, My Blog!</dc:creator><author>Rukas - Oh, My Blog!</author><pubDate>Wed, 23 Nov 2005 13:35:00 GMT</pubDate><guid>http://www.cnitblog.com/rukas/archive/2005/11/23/4855.html</guid><wfw:comment>http://www.cnitblog.com/rukas/comments/4855.html</wfw:comment><comments>http://www.cnitblog.com/rukas/archive/2005/11/23/4855.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/rukas/comments/commentRss/4855.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/rukas/services/trackbacks/4855.html</trackback:ping><description><![CDATA[<A href="http://www.supergloo.com/tmblog/2005/11/using-hibernate-synchronizer-3-with.html">http://www.supergloo.com/tmblog/2005/11/using-hibernate-synchronizer-3-with.html</A><BR><BR>
<H2 class=date-header>Thursday, November 10, 2005</H2><!-- Begin .post -->
<DIV class=post><A name=113165673660574954></A>
<H3 class=post-title>Using Hibernate Synchronizer 3 with Spring and Hibernate 3 </H3>
<DIV class=post-body>
<P>
<DIV style="CLEAR: both"></DIV>Popular question on Hibernate Synchronizer forum involves using it with Spring. Here's one way:<BR><BR>The following steps assume you have already installed the Hibernate Synchronizer in Eclipse:<BR><BR>1) Update the Hibernate Synchronizer to use a custom base root (<A href="http://www.supergloo.com/blogfiles/SpringHibernate3BaseRootDAO.java"><FONT color=#666699>Click Here for Source Code</FONT></A>)<BR><BR>From Menu bar: Project-&gt;Properties-&gt;Hibernate Synchronizer-&gt;Data Access Objects tab-&gt;Check "I would like to use a custom root" and enter full path to the SpringBaseRootDAO<BR><BR>2) Update the Hibernate Synchronizer to use a custom Exception class<BR>Same location as above. Enter "org.springframework.dao.DataAccessException" for DAO Exception input box<BR><BR>3) Update Base DAO Snippets<BR>a) On Eclipse Menu bar, click Window-&gt;Preferences<BR>b) Click Hibernate Synchronizer on left panel<BR>c) Click Snippets<BR>d) Expand Base DAO<BR>e) Replace Action Methods with <A href="http://www.supergloo.com/blogfiles/NEWBaseDAOActionMethods.txt"><FONT color=#6699cc>this</FONT></A><BR>f) Replace Finder Methods with <A href="http://www.supergloo.com/blogfiles/NEWBaseDAOFinderMethods.txt"><FONT color=#6699cc>this</FONT></A><BR>g) Replace Imports with <A href="http://www.supergloo.com/blogfiles/NEWBaseDAOImports.txt"><FONT color=#6699cc>this</FONT></A><BR>h) Replace Required Methods with <A href="http://www.supergloo.com/blogfiles/NEWBaseDAORequiredMethods.txt"><FONT color=#666699>this</FONT></A><BR><BR>(I removed JRE 1.5 specific content from snippets)<BR><BR>4) Configure your generated DAO(s) to inject a <A href="http://www.springframework.org/docs/api/org/springframework/orm/hibernate/LocalSessionFactoryBean.html"><FONT color=#6699cc>LocalSessionFactory</FONT></A> for HibernateTemplate's "sessionFactory" property (SpringBaseRootDAO extends <A href="http://www.springframework.org/docs/api/org/springframework/orm/hibernate/HibernateTemplate.html"><FONT color=#6699cc>HibernateTemplate</FONT></A>). For example, an entry in the applicationContext.xml might look like:<BR><BR>&lt;bean id="usersDataAccessObject" class="com.xyz.data.dao.UsersDAO"&gt;<BR>&lt;property name="sessionFactory"&gt;<BR>&lt;ref local="mySessionFactory"/&gt;<BR>&lt;/property&gt;<BR>&lt;/bean&gt;<BR><BR>Of course, the above example assumes you have "mySessionFactory" bean defined.<BR><BR>Hope this helps. Comments welcome. 
<DIV style="CLEAR: both; PADDING-BOTTOM: 0.25em"></DIV>
<P></P></DIV>
<P class=post-footer>posted by Todd McGrath at <A title="permanent link" href="http://www.supergloo.com/tmblog/2005/11/using-hibernate-synchronizer-3-with.html"><FONT color=#666699>12:59 PM</FONT></A> <SPAN class=item-action><A title="Email Post" href="http://www.blogger.com/email-post.g?blogID=12598366&amp;postID=113165673660574954"><SPAN class=email-post-icon><FONT color=#6699cc>&nbsp;</FONT></SPAN></A></SPAN><SPAN class="item-control admin-1164377311 pid-304472948"><A title="Edit Post" style="BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none" href="http://www.blogger.com/post-edit.g?blogID=12598366&amp;postID=113165673660574954&amp;quickEdit=true"><SPAN class=quick-edit-icon><FONT color=#6699cc>&nbsp;</FONT></SPAN></A></SPAN></P></DIV><!-- End .post --><!-- Begin #comments --><img src ="http://www.cnitblog.com/rukas/aggbug/4855.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/rukas/" target="_blank">Rukas - Oh, My Blog!</a> 2005-11-23 21:35 <a href="http://www.cnitblog.com/rukas/archive/2005/11/23/4855.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>