{"id":984,"date":"2010-10-02T00:24:46","date_gmt":"2010-10-02T00:24:46","guid":{"rendered":"http:\/\/enjoyasp.net\/?p=984"},"modified":"2010-10-02T00:24:46","modified_gmt":"2010-10-02T00:24:46","slug":"spring%e4%b8%8ehibernate%e7%9a%84%e8%9e%8d%e5%90%88","status":"publish","type":"post","link":"https:\/\/enjoyasp.net\/index.php\/2010\/10\/02\/spring%e4%b8%8ehibernate%e7%9a%84%e8%9e%8d%e5%90%88\/","title":{"rendered":"Spring\u4e0eHibernate\u7684\u878d\u5408"},"content":{"rendered":"<p>1,? \u5229\u7528myeclipse\uff0c\u4f1a\u5c11\u4e2d\u4e00\u4e2ajar\u5305\uff0c\u9700\u8981\u624b\u52a8\u52a0\u5165 commons-pool-1.3.jar<br \/>\n<a href=\"http:\/\/mirrors.ibiblio.org\/pub\/mirrors\/maven2\/commons-pool\/commons-pool\/1.3\/commons-pool-1.3.jar\">http:\/\/mirrors.ibiblio.org\/pub\/mirrors\/maven2\/commons-pool\/commons-pool\/1.3\/commons-pool-1.3.jar<\/a><br \/>\n\u6216\u67e5\u627emyeclipse\u5b89\u88c5\u76ee\u5f55\uff0c \u5728\u5982\u4e0b\u4f4d\u7f6e<br \/>\nmyeclipse\\eclipse\\plugins\\com.genuitec.org.hibernate.eclipse_6.0.1.zmyeclipse601200710\\lib\\springhibernate<\/p>\n<p>2, \u6dfb\u52a0Spring\u540e\u52a0hibernate\u65f6\uff0chibernate\u6700\u597d\u90fd\u9009\u4e2d\u6240\u6709\u7c7b\u5e93\uff0c\u4e4b\u540e\u9009\u62e9Spring\u7684applicationContext.xml\uff0c<br \/>\n\u8fd9\u6837\u5c31\u4f1a\u7528getHibernateTemplate().save(transientInstance)\u4e4b\u7c7b\u4ee3\u66ffsession\u8fdb\u884c\u6258\u7ba1,\u8fd9\u662fSpring\u4e0eHibernate\u6574\u5408\u7684\u6700\u5927\u597d\u5904\u3002<br \/>\nhibernate \u7684hbm.xml\u6587\u4ef6\u8981\u5728applicationContext.xml\u4e2d\u5f15\u5165\uff1a\u5373<br \/>\n&lt;bean id=&#8221;sessionFactory&#8221;<br \/>\nclass=&#8221;org.springframework.orm.hibernate3.LocalSessionFactoryBean&#8221;&gt;<br \/>\n&#8230;<br \/>\n&lt;property name=&#8221;mappingResources&#8221;&gt;<br \/>\n??? &lt;list&gt;<br \/>\n??????? &lt;value&gt;com\/lvjian\/model\/News.hbm.xml&lt;\/value&gt;??????<br \/>\n??? &lt;\/list&gt;<br \/>\n&lt;\/bean&gt;<\/p>\n<p>\u5bf9DAO\u6ce8\u5165\uff1asessionFactory<br \/>\n&lt;bean id=&#8221;consultingDao&#8221;<br \/>\nparent=&#8221;dao&#8221;&gt;<br \/>\n&lt;property name=&#8221;sessionFactory&#8221; ref=&#8221;sessionFactory&#8221; \/&gt;?<br \/>\n????????? \/\/sessionFactory\u5f53\u6307\u5b9aSpring\u63a5\u7ba1hibernate\u65f6\u81ea\u52a8\u914d\u7f6e\uff0c DAO\u7c7b\u8981\u5b9e\u73b0HibernateSurrort\u7c7b<br \/>\n&lt;\/bean&gt;<\/p>\n<p>3, \u5728\u5e94\u7528\u4e2d\uff0c\u6700\u597d\u5bf9\u751f\u6210\u7684dao\u8fdb\u884c\u5305\u88c5\uff0c\u7528\u4e00\u4e2a\u63a5\u53e3\u6765\u5b9a\u4e49dao\u65b9\u6cd5\uff0c\u5728action\u4e2d\u5229\u7528\u8fd9\u4e9b\u63a5\u53e3\u63d0\u4f9b\u7684\u65b9\u6cd5\u8fdb\u884c\u64cd\u4f5c<br \/>\n\u800c\u5728applicationContext.xml \u5bf9\u63a5\u53e3id\u6ce8\u5165impl\u7c7b\uff01<br \/>\n\u5373\uff1a\u5728\u8868\u5c42\u4e0a\u53ea\u7559\u63a5\u53e3\uff0c\u5b9e\u73b0\u7531applicationContext.xml\u914d\u7f6e\u5b8c\u6210<br \/>\n\u65b9\u6cd5\u4e3b\u8981\u53ef\u4ee5\u6709\uff1a<br \/>\n???????????? 1, \u67e5\u8be2? getAdmin\uff08id\uff09 \uff0cgetAdmins \u5f97\u5230\u6240\u6709, findByProperty(String propertyName, Object value)<br \/>\n???????????? 2, \u63d2\u5165 insertAdmin(Admin obj)<br \/>\n???????????? 3,\u66f4\u65b0? updateAdmin(Admin obj)<br \/>\n???????????? 4 \u5220\u9664?? deleteAdmin(Integer obj_id)<\/p>\n<p>\u6ce8\uff1aDAO\u7c7b\u8981\u5b9e\u73b0HibernateSurrort\u7c7b<br \/>\ncom.yourcompany.dao.inf<br \/>\ncom.yourcompany.dao.impl<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1,? \u5229\u7528myeclipse\uff0c\u4f1a\u5c11\u4e2d\u4e00\u4e2ajar\u5305\uff0c\u9700\u8981\u624b\u52a8\u52a0\u5165 commons-pool-1.3.jar h [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[],"class_list":["post-984","post","type-post","status-publish","format-standard","hentry","category-spring"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/984","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/comments?post=984"}],"version-history":[{"count":0,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/984\/revisions"}],"wp:attachment":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/media?parent=984"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/categories?post=984"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/tags?post=984"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}