由于spring对hibernate配置文件hibernate.cfg.xml的集成相当好, 可以使用spring的org.springframework.orm.hibernate3.LocalSessionFactoryBean来取代hibernate.cfg.xml文件的功能LocalSess...
分类:
移动开发 时间:
2015-10-23 16:24:30
阅读次数:
312
hibernate3 Duplicate class/entity mapping(异常)代码: Configuration config = new Configuration().addClass(User.class).buildSessionFactory();解决方法:去掉红色的代码。原因...
分类:
移动开发 时间:
2015-10-22 23:55:34
阅读次数:
232
1、Hibernate3的c3p0连接池的配置 在hibernate.cfg.xml中配置如下信息: com.mysql.jdbc.Driver jdbc:mysql:///hib_demo root root ...
分类:
Web程序 时间:
2015-10-11 22:54:08
阅读次数:
206
环境说明:spring4.0+hibernate3数据库:oracle连接池:c3p0项目结构:lib中的jar:一、配置spring.xml说明:这里采用的配置模式将hibernateTemplate注入至类NewsDaoImpl中。在本文的“附”中介绍的是在类NewsDaoImpl中自动装载hi...
分类:
编程语言 时间:
2015-10-05 23:21:20
阅读次数:
407
1.导入jar包包括lib\required 下所有jar包 根目录下hibernate3.jar(核心包)lib/jpa 下的包jdbc数据库包。2.编写Hibernate.configure.xml配置文件(包括数据库的链接信息和关联映射可以从压缩包中找到) 1 2 5 6 7 ...
分类:
Web程序 时间:
2015-10-03 23:13:49
阅读次数:
426
1,xml生成id generator:常用四个:native、identity、sequence、uuid。Annotation:1,@GeneratedValue: a)自定义ID b)AUTO: i,默认:对mysql,使用auto_increment ii,对oracle使...
分类:
Web程序 时间:
2015-10-02 16:07:08
阅读次数:
198
假如你把配置文件写错了,myeclipse竟然不报错,只说sf空指针。//或者你少写了.configure(),myeclipse也不报错sf = new AnnotationConfiguration().configure().buildSessionFactory();此时只需:@Before...
分类:
Web程序 时间:
2015-10-02 11:22:51
阅读次数:
228
日志的框架有很多,hibernate3.3.2用的是slf4j,slf4j简单理解为一个接口,标准.具体的实现可以是不同的实现(如slf4j自己的实现,log4j等)。slf就像JDBC,JPA。自己配置什么就是是什么。slf不是特别流行,下面劫介绍slf4j的接口对上log4j自己的实现。1,需要...
分类:
Web程序 时间:
2015-09-29 14:42:59
阅读次数:
186
程序目录:
运行效果:
一、首先导入jar包,导入JSF必要 jar包以及hibernate3.6jar包
(jsf jar稍后提供下载)
二、配置数据源:
在src下建立/MATA-INF/persistence.xml 文件
<persistence version="2.0"
xmlns="...
分类:
Web程序 时间:
2015-09-28 11:50:08
阅读次数:
325
classpath:jdbc.properties classpath:hiberna...
分类:
编程语言 时间:
2015-09-20 14:33:31
阅读次数:
225