日期:2014-05-17 浏览次数:20988 次
Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
at com.sun.proxy.$Proxy5.doDraw(Unknown Source)
at com.accp.service.impl.UserinfoServiceImpl.main(UserinfoServiceImpl.java:45)
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
UserinfoDao dao = (UserinfoDao) context.getBean("userinfoDao");
Userinfo userinfo = dao.findByBankNo(new BigDecimal("2222222222222222222"));
userinfo.setBalance(userinfo.getBalance()-100);
System.out.println(dao.doDraw(userinfo));
}
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
UserinfoService service = (UserinfoService) context.getBean("userinfoService");
Userinfo userinfo = service.findByBankNo(new BigDecimal("2222222222222222222"));
userinfo.setBalance(userinfo.getBalance()-100);
System.out.println(service.doDraw(userinfo));
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"></property>
<property name="url" value="jdbc:oracle:thin:@localhost:1521:orcl">
</property>
<property name="username" value="c##accp"></property>
<property name="password" value="accp"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.Oracle9Dialect
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/accp/po/Popedom.hbm.xml</value>
<value>com/accp/po/Loan.hbm.xml</value>
<value>com/accp/po/Deptpopedom.hbm.xml</value>
<value>com/accp/po/Userinfo.hbm.xml</value>
<value>com/accp/po/Dept.hbm.xml</value>
<value>com/accp/po/Loginfo.hbm.xml</value>
<value>com/accp/po/Employee.hbm.xml</value>
<value>com/accp/po/Exchange.hbm