spring整合 hibernate 映射出问题

报错信息
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegist
Caused by: org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister
at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:185)
at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:135)
at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:389)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1799)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870)
at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:339)
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:427)
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:412)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)
... 25 more
Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:138)
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:188)
at org.hibernate.tuple.entity.EntityMetamodel.(EntityMetamodel.java:341)
at org.hibernate.persister.entity.AbstractEntityPersister.(AbstractEntityPersister.java:506)
at org.hibernate.persister.entity.SingleTableEntityPersister.(SingleTableEntityPersister.java:146)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:163)
... 34 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:135)
... 43 more
Caused by: org.hibernate.PropertyNotFoundException: Could not find a getter for emloyees in class com.imooc.employee.domain.Department
at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:316)
at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:310)
at org.hibernate.mapping.Property.getGetter(Property.java:321)
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildPropertyGetter(PojoEntityTuplizer.java:444)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.(AbstractEntityTuplizer.java:200)
at org.hibernate.tuple.entity.PojoEntityTuplizer.(PojoEntityTuplizer.java:82)
... 48 more

实体类 一方package com.imooc.employee.domain;

import java.util.HashSet;
import java.util.Set;

public class Department {
private Integer did;
private String dname;
private String ddesc;

private Set<Employee> employees = new HashSet<Employee>();


public Integer getDid() {
    return did;
}
public Set<Employee> getEmployees() {
    return employees;
}
public void setEmployees(Set<Employee> employees) {
    this.employees = employees;
}
public void setDid(Integer did) {
    this.did = did;
}
public String getDname() {
    return dname;
}
public void setDname(String dname) {
    this.dname = dname;
}
public String getDdesc() {
    return ddesc;
}
public void setDdesc(String ddesc) {
    this.ddesc = ddesc;
}

}
多方
package com.imooc.employee.domain;

import java.util.Date;

public class Employee {
private Integer eid;
private String ename;
private String sex;
private Date birthday;
private Date joinDate;
private String eno;
private String username;
private String password;
private Department department;

public Integer getEid() {
    return eid;
}
public void setEid(Integer eid) {
    this.eid = eid;
}
public String getEname() {
    return ename;
}
public void setEname(String ename) {
    this.ename = ename;
}
public String getSex() {
    return sex;
}
public void setSex(String sex) {
    this.sex = sex;
}
public Date getBirthday() {
    return birthday;
}
public void setBirthday(Date birthday) {
    this.birthday = birthday;
}
public Date getJoinDate() {
    return joinDate;
}
public void setJoinDate(Date joinDate) {
    this.joinDate = joinDate;
}
public String getEno() {
    return eno;
}
public void setEno(String eno) {
    this.eno = eno;
}
public String getUsername() {
    return username;
}
public void setUsername(String username) {
    this.username = username;
}
public String getPassword() {
    return password;
}
public void setPassword(String password) {
    this.password = password;
}
public Department getDepartment() {
    return department;
}
public void setDepartment(Department department) {
    this.department = department;
}

}
配置文件

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">










    </set>
</class>

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<class name="com.imooc.employee.domain.Employee" table="employee">
    <id name="eid" column="eid">
        <generator class="native" />
    </id>
    <property name="ename" column="ename" length="20" />
    <property name="sex" column="sex" length="10" />
    <property name="birthday" column="birthday" /> 
    <property name="joinDate" column="joinDate" /> 
    <property name="eno" column="eno" length="20" />
    <property name="username" column="username" length="20" />
    <property name="password" column="password" length="20" />
    <many-to-one name="department" class="com.imooc.employee.domain.Department" column="dno"/>
</class>


jar包为
antlr-2.7.7.jar
aopalliance-1.0.jar
asm-5.1.jar
aspectjweaver.jar
c3p0-0.9.5.2.jar
catalina.jar
classmate-1.3.0.jar
commons-fileupload-1.3.2.jar
commons-io-2.4.jar
commons-lang3-3.2.jar
commons-logging-1.1.3.jar
dom4j-1.6.1.jar
ehcache-2.10.3.jar
freemarker-2.3.23.jar
hibernate-commons-annotations-4.0.2.Final.jar
hibernate-core-4.2.21.Final.jar
hibernate-ehcache-4.2.18.Final.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
jandex-2.0.3.Final.jar
javassist-3.18.1-GA.jar
jboss-logging-3.1.0.GA.jar
jboss-logmanager-2.0.4.Final.jar
jboss-transaction-api_1.1_spec-1.0.1.Final.jar
log4j-api-2.7.jar
log4j-core-2.7.jar
log4j-jboss-logmanager-1.1.2.Final.jar
mchange-commons-java-0.2.11.jar
mysql-connector-java-5.0.8.jar
ognl-3.1.12.jar
servlet-api.jar
slf4j-api-1.6.1.jar
slf4j-log4j12-1.7.19.jar
spring-aop-4.0.0.RELEASE.jar
spring-aspects-4.0.0.RELEASE.jar
spring-beans-4.0.0.RELEASE.jar
spring-context-4.0.0.RELEASE.jar
spring-context-support-4.0.0.RELEASE.jar
spring-core-4.0.0.RELEASE-javadoc.jar
spring-core-4.0.0.RELEASE-sources.jar
spring-core-4.0.0.RELEASE.jar
spring-expression-4.0.0.RELEASE-javadoc.jar
spring-expression-4.0.0.RELEASE-sources.jar
spring-expression-4.0.0.RELEASE.jar
spring-jdbc-4.0.0.RELEASE.jar
spring-orm-4.0.0.RELEASE-javadoc.jar
spring-orm-4.0.0.RELEASE-sources.jar
spring-orm-4.0.0.RELEASE.jar
spring-struts-3.2.0.RELEASE.jar
spring-test-4.0.0.RELEASE.jar
spring-tx-4.0.0.RELEASE-javadoc.jar
spring-tx-4.0.0.RELEASE-sources.jar
spring-tx-4.0.0.RELEASE.jar
spring-web-4.0.0.RELEASE-javadoc.jar
spring-web-4.0.0.RELEASE-sources.jar
spring-web-4.0.0.RELEASE.jar
struts2-convention-plugin-2.5.10.jar
struts2-core-2.5.10.jar
struts2-spring-plugin-2.5.10.jar
xwork - jar.jar
哪位大神能给看一下 问题出在哪里

1个回答

public Set getEmployees() {
return employees;
}
public void setEmployees(Set employees) {
this.employees = employees;
}

1 Department 这个类的配置文件,这个属性配置有问题,
2 一般都是list类型。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
spring整合hibernate出问题了
spring-hibernate配置如下:[code=text]rn rn rn rnrn rn rnrn rn rn rn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rnrn rn rn rn rn rn rn [/code]rn控制器代码:[img=https://img-bbs.csdn.net/upload/201609/11/1473554015_837185.png][/img]rnServiceImpl代码如下:[code=java] rn @Transactional(propagation=Propagation.REQUIRED)rn @Overridern public MyUser saveAll(MyUser user) rn return userDao.saveUser(user);rn rn[/code]rnrn问题:如果把java代码里面的事物注解给去掉,则会报如下信息:WARN 2016-09-11 07:49:00,093 com.swt.v2.daoimpl.UserDaoImpl.http-nio-8081-exec-12 Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.rn如果加上去,也有问题,我控制器循环的每次插10条,然而我刷新地址每次加一条
关于Spring整合Hibernate,映射实体类is not mapped
用了两种方式:rn1、rn[code=java] rn rn rn rn rn rn rn org.hibernate.dialect.MySQLDialectrn rn rn rn rn rn vo/Customer.hbm.xmlrn rn rn [/code]rn不可行,报错没有找到映射rn2、rn[code=java] rn rn rn rn rn rn rn rn rn org.hibernate.dialect.MySQLDialectrn rn rn rn [/code]rnhibernate.cfg.xml中: rn可行,可以执行成功rnrn搞不懂为什么第一种方式不行,求解
Spring整合hibernate
Spring整合hibernate开发例子,里面综合了crud的操作,适合新手学习
Spring整合Hibernate
博客对应代码
spring整合hibernate
[code=text]rnrn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rn com.entities.Accountrn com.entities.Bookrn rn rn rn rn rn org.hibernate.dialect.MySQL5InnoDBDialectrn truern truern updatern rn rn rnrn rn rn rnrn rn[/code]rn完全没有hibernate的配置文件rn配置文件如上,现在是把entities包中的每一个实体像[code=text] rn rn com.entities.Accountrn com.entities.Bookrn rn [/code]rn这样配置的。我看到提示中有这种形式,请教一下该怎么使用,谢谢。
Hibernate spring整合
我自己写的hibernate与sping的整合的练习。mysql数据库<br>希望对初学者有用呀
hibernate与spring整合
如果你已经学习了hibernate,spring。但你不知道如果整合。那我这个绝对适合你。
hibernate映射出问题了求大牛帮忙
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).rnlog4j:WARN Please initialize the log4j system properly.rn%%%% Error Creating SessionFactory %%%%rnorg.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]rn at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:110)rn at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:135)rn at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.(EntityEntityModeToTuplizerMapping.java:80)rn at org.hibernate.tuple.entity.EntityMetamodel.(EntityMetamodel.java:323)rn at org.hibernate.persister.entity.AbstractEntityPersister.(AbstractEntityPersister.java:456)rn at org.hibernate.persister.entity.SingleTableEntityPersister.(SingleTableEntityPersister.java:131)rn at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:84)rn at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:267)rn at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)rn at cn.bdqn.tangcoo.command.factory.HibernateSessionFactory.(HibernateSessionFactory.java:31)rn at cn.bdqn.tangcoo.command.template.HibernateTemplate.getsession(HibernateTemplate.java:32)rn at cn.bdqn.tangcoo.user.dao.impl.UserDaoHQLImpl.queryAllUser(UserDaoHQLImpl.java:28)rn at cn.bdqn.tangcoo.test.user.TestUser.testQueryAll(TestUser.java:50)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)rn at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)rn at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)rn at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)rn at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)rn at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)rn at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)rn at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)rn at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)rn at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)rn at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)rn at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)rn at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)rn at org.junit.runners.ParentRunner.run(ParentRunner.java:220)rn at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)rn at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)rnCaused by: java.lang.reflect.InvocationTargetExceptionrn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)rn at java.lang.reflect.Constructor.newInstance(Constructor.java:513)rn at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:107)rn ... 36 morernCaused by: org.hibernate.PropertyNotFoundException: Could not find a getter for grade in class cn.bdqn.tangcoo.entity.Studentrn at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:306)rn at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:299)rn at org.hibernate.mapping.Property.getGetter(Property.java:294)rn at org.hibernate.tuple.entity.PojoEntityTuplizer.buildPropertyGetter(PojoEntityTuplizer.java:300)rn at org.hibernate.tuple.entity.AbstractEntityTuplizer.(AbstractEntityTuplizer.java:141)rn at org.hibernate.tuple.entity.PojoEntityTuplizer.(PojoEntityTuplizer.java:78)rn ... 41 morern%%%% Error Creating SessionFactory %%%%rnorg.hibernate.InvalidMappingException: Could not parse mapping document from resource cn/bdqn/tangcoo/entity/Tbuser.hbm.xmlrn at org.hibernate.cfg.Configuration.addResource(Configuration.java:616)rn at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1635)rn at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1603)rn at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1582)rn at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1556)rn at org.hibernate.cfg.Configuration.configure(Configuration.java:1476)rn at cn.bdqn.tangcoo.command.factory.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:69)rn at cn.bdqn.tangcoo.command.factory.HibernateSessionFactory.getSession(HibernateSessionFactory.java:53)rn at cn.bdqn.tangcoo.command.template.HibernateTemplate.getsession(HibernateTemplate.java:32)rn at cn.bdqn.tangcoo.user.dao.impl.UserDaoHQLImpl.queryAllUser(UserDaoHQLImpl.java:28)rn at cn.bdqn.tangcoo.test.user.TestUser.testQueryAll(TestUser.java:50)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)rn at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)rn at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)rn at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)rn at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)rn at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)rn at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)rn at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)rn at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)rn at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)rn at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)rn at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)rn at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)rn at org.junit.runners.ParentRunner.run(ParentRunner.java:220)rn at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)rn at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)rnCaused by: org.hibernate.DuplicateMappingException: Duplicate class/entity mapping cn.bdqn.tangcoo.entity.Tbuserrn at org.hibernate.cfg.Mappings.addClass(Mappings.java:141)rn at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:167)rn at org.hibernate.cfg.Configuration.add(Configuration.java:716)rn at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:551)rn at org.hibernate.cfg.Configuration.addResource(Configuration.java:613)rn ... 34 more
Spring整合HIbernate
本代码适合准备整合Spring和Hibernate框架但是不知从何下手的同学
帮忙看看映射哪里出问题了,hibernate映射有什么技巧?
帮忙看看映射哪里出问题了,hibernate映射有什么技巧?rnrn[code=java]rnpublic class User rn private int id;rn private String name;rn private Vocation vocation;rnrn[/code]rnrn[code=java]rnpublic class Vocation rn private int id;rn private String name;rn private Vocation parent;rn private Set children;rn private Set users;rnrn[/code]rnrnUser.hbm.xmlrn[code=text]rn rn rn rn rn rn rn rn rn rn[/code]rnrnrnVocation.hbm.xmlrn[code=text]rn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rn rn rn rn rn rn rnrn[/code]rnrn怎么生成表是这个样子呢?rn[color=#FF0000]tt_user 列名:id name vocationId userIdrntt_vocation 列名:id name vocationId[/color]rn
mybatis 高级映射和spring整合之与Spring整合(6)
mybatis 高级映射和spring整合之mybatis与Spring整合 3.0 mybatis和spring整合(掌握) 3.1 整合思路 需求spring通过单例方式管理SqlSessionFactory。 spring和mybatis整合生成代理对象,使用SqlSessionFactory创建SqlSession。(spring和mybati...
mybatis 高级映射和spring整合之高级映射(4)
mybatis 高级映射和spring整合之高级映射 ————————————————学习结构———————————————————— 0.0 对订单商品数据模型进行分析 1.0 高级映射 1.1 一对一查询 1.2 一对多查询 1.3 多对多查询 1.4...
MyBatis Spring整合配置映射接口类与映射xml文件
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:context="http://www.springframework
hibernate出问题
在程序启动时,出现下面的提示:rnrnItem has already been added. Key in dictionary: 'hibernate.show_sql' Key being added: 'hibernate.show_sql'rnrn请问这是什么原因引起的?
Hibernate映射
里边有很多Hibernate,要用的东西我觉得还不错。个人觉得好
hibernate映射
hibernate映射.doc 好东西不解释啊
SSH笔记-Spring整合Hibernate
SSH笔记-Spring简单整合Hibernate的测试。。。。。。。
Spring整合hibernate的实例
Spring整合hibernate的实例
spring整合hibernate,struts
基于maven配置的web工程,运用spring注解方式整合hibernate和struts,通过配置方式进行jdbc配置
spring整合hibernate的所需jar包
spring整合hibernate的所需jar包,很全的!
struts hibernate spring整合的登陆
这是我自己做的一个struts_hibernate_spring登陆的小例子 我已经通过测试了<br>由于文件稍微大了点 我把所有的包删调了 需要时你们可以把sturts+hibernate+spring的包加进去 就OK了
Spring整合Hibernate 详解.doc
6.5 Spring整合Hibernate 6.6 Spring提供的DAO支持 6.5.2 管理Hibernate的SessionFactory 6.5.3 使用HibernateTemplate 6.5.4 使用HibernateCallBack 6.5.6 使用IoC容器组装各种组件 6.5.7启动web容器读取xml配置文件 6.5.8了解继承自HibernateDaoSupport类DAO
spring整合hibernate的jar包
整合了spring与hibernate2.X的jar包,copy进去就可用
Spring整合Hibernate案例
Spring框架整合Hibernate框架,为大家提供一个学习案例.
Spring整合Hibernate时的问题
在Spring整合Hibernate时,我用DAO的方式写了一个静态代理类IUserDAOProxy,并在其上使用了Annotation 使Spring容器将其初始化为一个名为proxy的Bean,并在其方法addUser加上了事务的Annotation,之后再Junit单元测试时从ApplicationContext中getBean("proxy")时得到的并不是IUserDAOProxy类型的对象,而是一个动态代理类的对象,若没有在其上加事务的话,得到的就是IUserDAOProxy类的对象,这是为什么呢?rnrn1.有一个静态代理类:rn @Component("proxy")rnpublic class IUserDAOProxy implements IUserDao rn rn private IUserDao uDao;rn private MyLogService myLogService;rn rn rn public MyLogService getMyLogService() rn return myLogService;rn rn @Resourcern public void setMyLogService(MyLogService myLogService) rn this.myLogService = myLogService;rn rn public IUserDAOProxy() rn rn public IUserDAOProxy( IUserDao uDao)rn this.uDao=uDao;rn rn @Resourcern public void setuDao( IUserDao udao) rn rn this.uDao = udao;rn rn @Overridern @Transactionalrn public void addUser(User user) rn uDao.addUser(user);rn System.out.println("************"+this.getClass().getName()+"****************");rn Log mylog=new Log();rn mylog.setMessage("addUser增加用户了");rn myLogService.addLogBefore(mylog);rn rnrn2.如上可见在此类上加上了事务。rn3.在JUnit用到了下面代码rn ApplicationContext beanfactory=new ClassPathXmlApplicationContext("beans.xml");rn // IUserDAOProxy userproxy=(IUserDAOProxy)beanfactory.getBean("proxy"); rn IUserDao userproxy=(IUserDao)beanfactory.getBean("proxy");rn 从beanFactory中得到的类名是$Proxy11,而不是IUserDAOProxy.rn4.这个代理类实现的接口有:rn***************实现的接口*****************rninterface cn.yang.dao.IUserDaorninterface org.springframework.aop.SpringProxyrninterface org.springframework.aop.framework.Advisedrn5.其父类是:java.lang.reflect.Proxyrn 构造方法只有一个rn $Proxy11(java.lang.reflect.InvocationHandler)rn
spring整合hibernate问题。。。。
在项目包结构中,src/jdbc.properties(动态获取数据库信息) 在spring的默认配置文件application.xml加载路径是 classpath:jdbc.propertis 而application.xml在加载src/com/demo/entity/*.hbm.xml(sessionFactory的属性中有个rn rn com/demo/entity/*.hbm.xmlrnrn)rn这两个路径为什么一个带classpath:,一个不带classpath:? 这两个文件都是在src目录下的。rnweb项目部署后的默认路径是什么?
spring整合hibernate时配置文件
&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt; &amp;lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:mvc=&quot;http://www.springframewo
hibernate与spring整合的配置文档问题
去指定包下自动生成@component注释的对象     提供注释     -->               AOP配置                                             -->                                                
struts hibernate spring整合的问题
整合的时候出现了问题,请指点。代码如下:rnrnweb.xmlrnrnrnrnrn rn Jbpm_sshrn rn rn rn rn actionrn org.apache.struts.action.ActionServletrn rn configrn /WEB-INF/struts-config.xmlrn rn rn rn actionrn *.dorn rn rnrnrn rn rn index.htmlrn index.htmrn index.jsprn default.htmlrn default.htmrn default.jsprn rnrnrnrnrnstruts-config.xmlrnrnrnrnrnrnrnrnrnrnrnrn rn rn rn rnrnrnrnrn rn rn rn rn rn rn rn rn rnrnrnrn rnrnrnrnrn rn rn rn rn rn rn rn rn rnrnrnrnapplicationContext.xmlrnrnrnrnrnrn rn rn rn hibernate.cfg.xml rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn com.jbpm.service.LoginServicern rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn PROPAGATION_REQUIREDrn PROPAGATION_REQUIREDrn rn PROPAGATION_REQUIRED,readOnlyrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrnrnrn提交表单的时候报错,如下:rnHTTP Status 404 - Servlet action is not availablernrn--------------------------------------------------------------------------------rnrntype Status reportrnrnmessage Servlet action is not availablernrndescription The requested resource (Servlet action is not available) is not available.rnrnrn--------------------------------------------------------------------------------rnrnApache Tomcat/5.0.30rnrn请问是什么问题。
Spring整合Hibernate问题
大家对让Spring来控制Hibernate的Sessionfactory这样的整合方式有什么看法么???rn我到现在都想不出来为什么要这么做,这么做有什么好处?rn我认为Spring就管业务层的东西就可以了。rnrn郁闷中……………………
spring整合hibernate的问题
我用MyEclipse6.0开发项目.spring整合hibernate的问题:我加的包出现了ASM错误!我找资料说删掉asn-2.2.3.jar包!我建立的项目不是用COPY进去的!是用MyEclipse自动加进去的!它把包都放在MyEclipse的安装目录下了!请问怎么删asn-2.2.3.jar包
spring整合hibernate 数据库问题!
rn rn $jdbc.driverClassNamern rn rn $jdbc.urlrn rn rn $jdbc.usernamern rn rn $jdbc.passwordrn rn rn $c3p0.acquireIncrementrn rn rn $c3p0.initialPoolSizern rn rn $c3p0.minPoolSizern rn rn $c3p0.maxPoolSizern rn rn $c3p0.maxIdleTimern rn rn $c3p0.idleConnectionTestPeriodrn rn rn $c3p0.maxStatementsrn rn rn $c3p0.numHelperThreadsrn rn
关于Spring整合Hibernate实例
关于Spring整合Hibernate实例 1.概述 由IOC容器来生成hibernate的sessionFactory. 让hibernate使用spring的声明式事务 2.整合步骤 2.1导入所需要的包 由于我是使用Maven搭建工程,但是有些依赖怎么下都下不了,最后迫不得已还是新建一个lib来导入所需要的jar包。 2.2在Java中定义数据库表 这里是由Hibernate来创建数...
Spring整合Hibernate的多种数据源配置
1。属性占位符配置器:可以将相关属性抽取出来放入配置文件(比如数据库的连接信息),然后用占位符的方式读取出来,方便文件的分类管理     xmlns="http://www.springframework.org/schema/beans"     xsi:schemaLocation="http://www.springframework.org/schema/beans
spring整合hibernate的两种方式
我们学过spring的同学都知道,spring可以整合其他的框架协同开发,大大的降低开发的时间和提高了效率,但是我们在配置的时候总会发生各种各样的问题,下面我记录一下我在配置的时候出现的问题和简单总结一下配置的过程 这个文件是hibernate的配置文件,里面配置了一个映射文件User.hbm.xml这个就不解释了,不懂的可以去参看hibernate的视频.然后我们都知道要和spring进行
Spring整合加载Hibernate文件
<property name="annotatedClasses"> <list> <value>com.sise.domain.Admin</value> <value>com.sise.domain.Remind</value> <value>com.sise.domain.User</value> </list> </propert
spring整合hibernate开发源码
spring整个hibernate 开发完整实例源码
Spring整合Hibernate遇到的问题
1、刷新模式的问题,FlushMode.MANUALWrite operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition org
相关热词 c#入门推荐书 c# 解码海康数据流 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池 c#5.0 安装程序 c# 分页算法