hibernate spring annotation setup
- First step setup for the pom.xml with hibernate dependency ,
hibernate dependency need to before the struts2,because the javassist dependency
<dependency><groupId>com.google.guava</groupId><artifactId>guava</artifactId><version>RELEASE</version></dependency><dependency><groupId>javax.servlet</groupId><artifactId>javax.servlet-api</artifactId><version>${servlet.version}</version><scope>provided</scope></dependency><dependency><groupId>javax.servlet.jsp</groupId><artifactId>jsp-api</artifactId><version>${servlet.jsp.version}</version><type>jar</type><scope>test</scope></dependency><!-- log4j dependency --><dependency><groupId>log4j</groupId><artifactId>log4j</artifactId><version>${log4j.version}</version></dependency><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>${junit.version}</version><scope>test</scope></dependency><!-- hibernate5 --><!-- hibernate 5 dependencies --><dependency><groupId>org.hibernate</groupId><artifactId>hibernate-core</artifactId><version>${hibernate.version}</version></dependency><dependency><groupId>org.jboss.spec.javax.transaction</groupId><artifactId>jboss-transaction-api_1.2_spec</artifactId><version>${jboss.api.version}</version></dependency><!-- Spring framework --><dependency><groupId>org.springframework</groupId><artifactId>spring-core</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-tx</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-beans</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-web</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-expression</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-orm</artifactId><version>${spring.version}</version></dependency><dependency><groupId>commons-dbcp</groupId><artifactId>commons-dbcp</artifactId><version>${spring.dbcp.version}</version></dependency><dependency><groupId>xml-apis</groupId><artifactId>xml-apis</artifactId><version>${spring.xmapis.version}</version></dependency><!-- struts2 dependency had included spring dependencies --><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-core</artifactId><version>${struts2.version}</version></dependency><!-- http://www.mkyong.com/struts2/struts-2-hello-world-annotation-example/ --><!-- --><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-convention-plugin</artifactId><version>${struts2.version}</version></dependency><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-json-plugin</artifactId><version>${struts2.version}</version></dependency><!-- input: http://localhost:8888/Mybatis_Sample/config-browser/index.action --><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-config-browser-plugin</artifactId><version>${struts2.version}</version></dependency><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-junit-plugin</artifactId><version>${struts2.version}</version><scope>test</scope></dependency><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-spring-plugin</artifactId><version>${struts2.version}</version></dependency>
2. ApplicationContext.xml for hibernate :
<bean id="sessionFactory"class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"><property name="dataSource" ref="dataSource" /><property name="packagesToScan" value="${entities.path}" /><property name="hibernateProperties"><props><prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop><prop key="hibernate.dialect">${hibernate.dialect}</prop><prop key="hibernate.show_sql">${hibernate.show_sql}</prop><prop key="hibernate.format_sql">${hibernate.format_sql}</prop></props></property></bean>
3. Install the hibernate tool to generate the entity class automatically:

choose the “hibernate tool” and “hibernate maven integration” and follow the step to install it .
4.using the hibernate reverse engineering(reveng.xml) to generate the reveng.xml file
5.using the hibernate code generate tool to generate the hibernate entities
6.create a new hibernate.cfg.xml file and then create the hibernate console
7.then you can use the HQL editor and hibernate criteria editor .

hibernate spring annotation setup的更多相关文章
- Spring的annotation用在set方法上 hibernate的annotation用get方法上
1.Spring的annotation用在set方法上 2.hibernate的annotation用在get方法上
- 最新版ssh hibernate spring struts2环境搭建
最新版ssh hibernate spring struts2环境搭建 最新版spring Framework下载地址:spring4.0.0RELEASE环境搭建 http://repo.sprin ...
- 【转】pringMVC+Hibernate+Spring 简单的一个整合实例
ref:http://langgufu.iteye.com/blog/2088355 SpringMVC又一个漂亮的web框架,他与Struts2并驾齐驱,Struts出世早而占据了一定优势,我在博客 ...
- Hibernate的Annotation注解
当项目变得比较大的时候,如何还使用hbm.xml文件来配置Hibernate实体就会变得比较复杂.这里Hibernate提供了Annotation注解方式,使得Hibernate的映射文件变得很方便管 ...
- hibernate+spring+mvc+Easyui框架模式下使用grid++report的总结
最近刚开始接触hibernate+spring+mvc+Easyui框架,也是刚开通了博客,希望能记录一下自己实践出来的东西,让其他人少走弯路. 转让正题,以个人浅薄的认识hibernate对于开发人 ...
- 工作笔记3.手把手教你搭建SSH(struts2+hibernate+spring)环境
上文中我们介绍<工作笔记2.软件开发经常使用工具> 从今天開始本文将教大家怎样进行开发?本文以搭建SSH(struts2+hibernate+spring)框架为例,共分为3步: 1)3个 ...
- SpringMVC Hibernate+Spring+Spring MVC+Bootstrap的管理系统实现
SpringMVC学习系列(12) 完结篇 之 基于Hibernate+Spring+Spring MVC+Bootstrap的管理系统实现 到这里已经写到第12篇了,前11篇基本上把Spring M ...
- 三大框架:Struts+Hibernate+Spring
三大框架:Struts+Hibernate+Spring Java三大框架主要用来做WEN应用. Struts主要负责表示层的显示 Spring利用它的IOC和AOP来处理控制业务(负责对数据库的操作 ...
- Structs hibernate spring=ssh简介
Structs hibernate spring Struts Struts是一个基于Sun J2EE平台的MVC框架,主要是采用Servlet和JSP技术来实现的. Struts框架可分为以下四 ...
随机推荐
- QEMU命令创建KVM Guest(bridge桥接)
1. Check QEMU version [root@pqsfc018 ~]# /usr/bin/qemu-system-x86_64 -version QEMU emulator version ...
- linux ps命令
名称:ps 使用权限:所有使用者 使用方式:ps [options] [--help] 说明:显示瞬间行程 (process) 的动态 参数: ps 的参数非常多, 在此仅列出几个常用的参数并大略介绍 ...
- jobs 命令
jobs命令 显示了当前 shell 环境中已启动的作业状态. 如果 JobID 参数没有指定特定作业,就显示所有的活动的作业的状态信息. 如果报告了一个作业的终止,shell 从当前的 shell ...
- JSON和js对象之间的相互转化
jQuery插件支持的转换方式 $.parseJSON( jsonstr ); //jQuery.parseJSON(jsonstr),可以将json字符串转换成json对象 http://www. ...
- web兼容性测试
1.前端的兼容性问题 a. 客户端操作系统 -pc电脑 -windows -mac os -Linux -平板 -手机 -智能终端 -响应式布局 借助于css3 b.客户端浏览器 IE firefo ...
- poj3264 - Balanced Lineup(RMQ_ST)
Balanced Lineup Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 45243 Accepted: 21240 ...
- 关于hr标签兼容个浏览器的代码
hr标签,相信大家都能熟悉,我们一般用它来产生横线的效果.我们可以对它定义“颜色”.“高度”.“宽度”.“边框”等样式. 在此只讨论“颜色”和“边框”对于不同版本浏览器的兼容性. 颜色: 火狐.IE7 ...
- centos7 配置vnc
这是一个关于怎样在你的 CentOS 7 上安装配置 VNC 服务的教程.当然这个教程也适合 RHEL 7 .在这个教程里,我们将学习什么是 VNC 以及怎样在 CentOS 7 上安装配置 VNC ...
- 项目学习——电力系统底层架构ssh
电力系统底层架构1.建立web工程 创建数据库 导入向对应的jar包2. 持久层: (1)在cn.itcast.elec.domain中创建持久化类ElecText @SuppressWarnings ...
- C#设计模式(7)——适配器模式(Adapter Pattern)
一.引言 在实际的开发过程中,由于应用环境的变化(例如使用语言的变化),我们需要的实现在新的环境中没有现存对象可以满足,但是其他环境却存在这样现存的对象.那么如果将“将现存的对象”在新的环境中进行调用 ...