昨天晚上在学习spring和hibernate整合时,发现自己的表总提示 not exist
在applicationContext.xml配置如下
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hbm2ddl.auto">update</prop>
</props>
</property>
配置应该没什么问题 后来把hibernate中的那个log4j包删了 看控制台的提示发现问题
原来是映射文件和类的一个属性不匹配 写错了
确实尝试自动建表了 但是没成功 所以就提示 not exist了
另外在spring中可以将spring的配置文件和hibernate的配置文件分开
<bean id="MySessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
其中classpath:hibernate.cfg.xml就是相应的hibernate配置文件所在位置
这样就可以以熟悉的hibernate的方式进行配置了
分享到:
相关推荐
(1)在config中找到db.properties:连接自己的mysql (2)在连接到的mysql中建一个数据库(database):(defaultName:mvcdemo) (3)运行本项目 (4)页面输入 http://localhost:8080//mvcfour/index.html (注意浏览器支持...
项目原型:Struts2.3.16 + Spring4.1.1 + Hibernate4.3.6 二、 项目目的: 整合使用最新版本的三大框架(即Struts2、Spring4和Hibernate4),搭建项目架构原型。 项目架构原型:Struts2.3.16 + Spring4.1.1 + ...
springboot+mybatisplus自动建表案例
SSH高质量整合.Spring注解标签,项目启动自动建表. 标签注入,管理更简单 QQ95546772
在spring中使用Hibernate是平时项目中很常用的做法,下面就具体步骤进行
spring-hibernate.jar
Spring4.0+Hibernate4.0+Struts2.3整合案例:实现增删改查。 ===================== application.xml: xmlns="http://www.springframework.org/schema/beans" xmlns:xsi=...
Spring Persistence with Hibernate
这是一个struts 1.2 + spring 2.5 + hibernate 3.2框架demo, 运行环境为eclipse 3.2 + tomcat 5.5 + oracle 11g
必备软件 学习struts2项目struts2+spring4+hibernate 必备
spring mvc + spring + hibernate 全注解整合开发视频教程 11
Spring2.5.chm Hibernate_3.2.0.chm Spring2.5和Hibernate3.2中文手册
eclipse工具,用Maven搭建的Spring+Spring MVC+Hibernate框架源码
spring 与hibernate的集成方法 spring 与hibernate的集成方法
在Spring中配置Hibernate事务
Spring+Hibernate运行时所出现的异常Caused by java.lang.StringIndexOutOfBoundsException String index out解决方法
01. 采用后台及前台的 Spring + Spring mvc + Hibernate + Bootstrap 02. 后台全注解式的开发(除了必要的spring和hibernate的xml配置以外) 03. 后台通过自定义注解结合一个访问拦截器实现整个系统的权限控制 04...
以上是springmvc+spring+hibernate整合基于eclipse,oracle开发
struts2.2.3+spring3.0.1+hibernate3.6.5整合jar包