关于SSH的一些错误总是感到莫名奇妙,大家帮忙解决下

来源:互联网  时间:2016/7/25 13:32:38

关于网友提出的“ 关于SSH的一些错误总是感到莫名奇妙,大家帮忙解决下”问题疑问,本网通过在网上对“ 关于SSH的一些错误总是感到莫名奇妙,大家帮忙解决下”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:

问题: 关于SSH的一些错误总是感到莫名奇妙,大家帮忙解决下
描述:

学SSH真郁闷,有时候错误会莫名奇妙,比如前些天我把

update
改为code=Java]update[[/code],一个一直报错的项目就不错了,那个郁闷啊....
开始测试没问题,然后猛的初始化Spring的容器都报错,就是ApplicationContext ctx=new ClassPathXmlApplicationContext("applicationContext.xml");这一句。现在这个错误是:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'proService': Injection of resource methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateTemplate' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is 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 java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:275)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1030)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
.....

我的bean.xml文件:


       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:c/>      

    
        classpath:jdbc.properties
    

<>
      class="org.apache.commons.dbcp.BasicDataSource">
    
    
    
    

<>
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">



com.rh.bean.product.ProductType




     org.hibernate.dialect.MySQLDialect
     thread
     true
     update
    







用到的实体类的代码:
package com.rh.bean.product;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
@Entity
public class ProductType {
private Integer typeid;
/**类别名称*/
private String name;
/**在google上 的描述*/
private String note;
/**是否可见*/
private Boolean visible=true;
/**得到所有子类别*/
private Set childtypes=new HashSet();
/**所属父类*/
private ProductType parent;
@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
public Integer getTypeid() {
return typeid;
}
public void setTypeid(Integer typeid) {
this.typeid = typeid;
}
@Column(length=36,nullable=false)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Column(length=100)
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
@Column(nullable=true)
public Boolean getVisible() {
return visible;
}
public void setVisible(Boolean visible) {
this.visible = visible;
}
@OneToMany(cascade={CascadeType.REMOVE,CascadeType.REFRESH})
public Set getChildtypes() {
return childtypes;
}
public void setChildtypes(Set childTypes) {
this.childtypes = childTypes;
}
@ManyToOne(opti /> @JoinColumn(name="parentid")
public ProductType getParent() {
return parent;
}
public void setParent(ProductType parent) {
this.parent = parent;
}
}
,请大家帮忙找下错误啊。谢谢

上一篇编写网络程序
下一篇乱码问题!使用jar文件运行往数据库插入数据乱码!
明星图片
相关文章
《 关于SSH的一些错误总是感到莫名奇妙,大家帮忙解决下》由码蚁之家搜集整理于网络,
联系邮箱:mxgf168#qq.com(#改为@)