日期:2014-05-18 浏览次数:20938 次
@Entity
@Table(name = "Student")
public class Student implements java.io.Serializable {
private static final long serialVersionUID = 1L;
/** 属性userCode */
private String userCode;
private String userName;
/**
* 类Student的默认构造方法
*/
public Student() {
}
/**
* 属性userCode的getter方法
*/
@Id
@Column(name = "USERCODE")
public String getUserCode() {
return this.userCode;
}
public void setUserCode(String userCode) {
this.userCode = userCode;
}
@Column(name = "USERNAME")
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
<context:component-scan base-package="com.sinosoft" />
<!-- 属性文件读入 -->
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:/jdbc.properties</value>
</list>
</property>
</bean>
<bean id="dataSourceTarget"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName"
value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<property name="maxActive" value="${jdbc.maxActive}" />
</bean>
<!-- 开发用,用于拦截执行的SQL并打印-->
<bean id="dataSource" class="com.p6spy.engine.spy.P6DataSource">
<constructor-arg>
<ref local="dataSourceTarget" />
</constructor-arg>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<!--
<property name="mappingResources">
<list></list>
</property>
<property name="mappingLocations">
<list>
<value>classpath*:/*.hbm.xml</value>
</list>
</property>
-->
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
${hibernate.dialect}
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<!-- <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop> -->
<prop key="hibernate.cache.provider_class">
org.hibernate.cache.HashtableCacheProvider
</prop>
<prop&n