配置文件:
?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<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/cq/bean/SysUser.hbm.xml</value>
</list>
</property>
</bean>
<!-- 数据源 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@192.168.0.101:1521:chen"/>
<property name="username" value="wfm"/>
<property name="password" value="wfm"/>
<property name="maxActive" value="100"/>
<property name="maxIdle" value="30"/>
<property name="maxWait" value="1000"/>
<property name="defaultAutoCommit" value="true"/>
<property name="removeAbandoned" value="true"/>
<property name="removeAbandonedTimeout" value="60"/>
</bean>
<!-- 服务代理-事务管理 -->
<bean id="sysUserService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="proxyInterfaces">
<list>
<value>com.springinaction.training.service.CourseService<!-- 代理实现接口 -->
</value>
</list>
</property>
<property name="target">
<ref bean="sysUserTarget"/><!-- 被代理的对象 -->
</property>
<property name="transactionAttributes">
<props>
<prop key="find*">
PROPAGATION_REQUIRED,readOnly,-OrderException
</prop>
<!--<prop key="save*">
PROPAGATION_REQUIRED,-OrderException,-OrderMinimumAmountException
</prop>
--></props>
</property>
</bean>
<bean id="sysUserTarget" class="com.cq.BO.Impl.SysUserImpl"/>
</beans>
?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<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/cq/bean/SysUser.hbm.xml</value>
</list>
</property>
</bean>
<!-- 数据源 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@192.168.0.101:1521:chen"/>
<property name="username" value="wfm"/>
<property name="password" value="wfm"/>
<property name="maxActive" value="100"/>
<property name="maxIdle" value="30"/>
<property name="maxWait" value="1000"/>
<property name="defaultAutoCommit" value="true"/>
<property name="removeAbandoned" value="true"/>
<property name="removeAbandonedTimeout" value="60"/>
</bean>
<!-- 服务代理-事务管理 -->
<bean id="sysUserService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="proxyInterfaces">
<list>
<value>com.springinaction.training.service.CourseService<!-- 代理实现接口 -->
</value>
</list>
</property>
<property name="target">
<ref bean="sysUserTarget"/><!-- 被代理的对象 -->
</property>
<property name="transactionAttributes">
<props>
<prop key="find*">
PROPAGATION_REQUIRED,readOnly,-OrderException
</prop>
<!--<prop key="save*">
PROPAGATION_REQUIRED,-OrderException,-OrderMinimumAmountException
</prop>
--></props>
</property>
</bean>
<bean id="sysUserTarget" class="com.cq.BO.Impl.SysUserImpl"/>
</beans>
?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<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/cq/bean/SysUser.hbm.xml</value>
</list>
</property>
</bean>
<!-- 数据源 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@192.168.0.101:1521:chen"/>
<property name="username" value="wfm"/>
<property name="password" value="wfm"/>
<property name="maxActive" value="100"/>
<property name="maxIdle" value="30"/>
<property name="maxWait" value="1000"/>
<property name="defaultAutoCommit" value="true"/>
<property name="removeAbandoned" value="true"/>
<property name="removeAbandonedTimeout" value="60"/>
</bean>
<!-- 服务代理-事务管理 -->
<bean id="sysUserService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="proxyInterfaces">
<list>
<value>com.springinaction.training.service.CourseService<!-- 代理实现接口 -->
</value>
</list>
</property>
<property name="target">
<ref bean="sysUserTarget"/><!-- 被代理的对象 -->
</property>
<property name="transactionAttributes">
<props>
<prop key="find*">
PROPAGATION_REQUIRED,readOnly,-OrderException
</prop>
<!--<prop key="save*">
PROPAGATION_REQUIRED,-OrderException,-OrderMinimumAmountException
</prop>
--></props>
</property>
</bean>
<bean id="sysUserTarget" class="com.cq.BO.Impl.SysUserImpl"/>
</beans>
?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<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/cq/bean/SysUser.hbm.xml</value>
</list>
</property>
</bean>
<!-- 数据源 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@192.168.0.101:1521:chen"/>
<property name="username" value="wfm"/>
<property name="password" value="wfm"/>
<property name="maxActive" value="100"/>
<property name="maxIdle" value="30"/>
<property name="maxWait" value="1000"/>
<property name="defaultAutoCommit" value="true"/>
<property name="removeAbandoned" value="true"/>
<property name="removeAbandonedTimeout" value="60"/>
</bean>
<!-- 服务代理-事务管理 -->
<bean id="sysUserService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="proxyInterfaces">
<list>
<value>com.springinaction.training.service.CourseService<!-- 代理实现接口 -->
</value>
</list>
</property>
<property name="target">
<ref bean="sysUserTarget"/><!-- 被代理的对象 -->
</property>
<property name="transactionAttributes">
<props>
<prop key="find*">
PROPAGATION_REQUIRED,readOnly,-OrderException
</prop>
<!--<prop key="save*">
PROPAGATION_REQUIRED,-OrderException,-OrderMinimumAmountException
</prop>
--></props>
</property>
</bean>
<bean id="sysUserTarget" class="com.cq.BO.Impl.SysUserImpl"/>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<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/cq/bean/SysUser.hbm.xml</value>
</list>
</property>
</bean>
<!-- 数据源 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@192.168.0.101:1521:chen"/>
<property name="username" value="wfm"/>
<property name="password" value="wfm"/>
<property name="maxActive" value="100"/>
<property name="maxIdle" value="30"/>
<property name="maxWait" value="1000"/>
<property name="defaultAutoCommit" value="true"/>
<property name="removeAbandoned" value="true"/>
<property name="removeAbandonedTimeout" value="60"/>
</bean>
<!-- 服务代理-事务管理 -->
<bean id="sysUserService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"><!--
<property name="proxyInterfaces">
<list>
<value>com.springinaction.training.service.CourseService 代理实现接口
</value>
</list>
</property>-->
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="target">
<ref bean="sysUserTarget"/><!-- 被代理的对象 -->
</property>
<property name="transactionAttributes">
<props>
<prop key="find*">
PROPAGATION_REQUIRED,readOnly,-OrderException
</prop>
<!--<prop key="save*">
PROPAGATION_REQUIRED,-OrderException,-OrderMinimumAmountException
</prop>
--></props>
</property>
</bean>
<bean id="sysUserTarget" class="com.cq.BO.Impl.SysUserImpl"/>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
</beans>
<key-property name="XXX" type="string">
<column name="XXXX" length="32" />
</key-property>
对应的类型不能是(java.lang.String)
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.cq.bean.SysUser" table="SYS_USER" schema="WFM">
<id name="userCode" type="java.lang.Long">
<column name="USER_CODE" scale="0" />
<generator class="assigned" />
</id>
<property name="userAccount" type="java.lang.String">
<column name="USER_ACCOUNT" length="50" />
</property>
<property name="userPwd" type="java.lang.String">
<column name="USER_PWD" length="100" />
</property>
<property name="userName" type="java.lang.String">
<column name="USER_NAME" length="100" />
</property>
<property name="userMemo" type="java.lang.String">
<column name="USER_MEMO" length="1000" />
</property>
<property name="userFlag" type="java.lang.Long">
<column name="USER_FLAG" precision="22" scale="0" />
</property>
<property name="userSortId" type="java.lang.Long">
<column name="USER_SORT_ID" precision="22" scale="0" />
</property>
<property name="userType" type="java.lang.String">
<column name="USER_TYPE" length="1" />
</property>
<property name="userMaster" type="java.lang.String">
<column name="USER_MASTER" length="50" />
</property>
</class>
</hibernate-mapping>
type="java.lang.Long" 改 type="long"
不知道为什么??