eirc0522 2013-11-27 08:52
浏览 1124

常见的SSH执行save方法报错,

报错:Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'driverClassName' of bean class [com.mchange.v2.c3p0.ComboPooledDataSource]: Bean property 'driverClassName' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

页面代码: private static PersonDAO psd;
private static ApplicationContext cxt;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
try {
cxt = new ClassPathXmlApplicationContext("beans.xml");
psd =(PersonDAO)cxt.getBean("serivceBean");
} catch (Exception e) {
e.printStackTrace();
}
}

@Test
public void testSave() {
    psd.save(new Person("xxx"));
}

业务bean:
@Resource private SessionFactory sessionFactoy;

public void save(Person person) {
    sessionFactoy.getCurrentSession().persist(person);
}

实体类:
private Integer id;
private String username;

    public Person(){}
    public Person(String username) {
        this.username = username;
    }
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }

beans.xml:
destroy-method="close">
.....

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程
    • ¥15 redis-full-check比较 两个集群的数据出错
    • ¥15 Matlab编程问题
    • ¥15 训练的多模态特征融合模型准确度很低怎么办
    • ¥15 kylin启动报错log4j类冲突
    • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
    • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序