用MyEclipse自动生成hibernate3.2+spring2.5的DAO,MODEL

首先的准备工作,新建一个表,并且建立一个web项目

先后添加spring支持,不要选择任何库,下面选Copy Checked Libraries jar to project folder and add to build-path


先后添加hibernate支持(右击项目点选add hibernate Capabilities),选择hibernate3.2勾上Enable Hibernate Annotations Support,下面选Copy Checked Libraries jar to project folder and add to build-path

然后点next,在select the type of configuration file  MyEclipse Hibernate Tools will use for这里选择spring configuration file,下一步点finish


然后切换到Myeclipse hibernate视图

选中你要转换成MODEL的类,设置好你的JAVA SRC FOLDER,勾选Create POJO<>DB Table mapping information下面的Add Hibernate mapping annotations to POJO(Hibernate 3.2 only),勾上Java Data Object(POJO<>DB Table),勾上Java Data Object(DAO),DAO type:选Spring DAO

这样就会自动帮你生成DAO了

你可能感兴趣的:(DAO,spring,Hibernate,Web,MyEclipse)