日期:2014-05-16 浏览次数:20537 次

mysql> select version(); -------------- select version() -------------- +----------------------+ | version() | +----------------------+ | 5.1.41-community-log | +----------------------+ 1 row in set (0.00 sec)
--launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m -vm C:/Program Files/Java/jdk1.6.0_18/bin/javaw -vmargs -Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx512m
package com.model;
import java.io.Serializable;
import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* @author <a href="liu.anxin13@gmail.com">Tony</a>
*/
@Entity
@Table(name = "T_USERINFO")
@org.hibernate.annotations.Entity(selectBeforeUpdate = true, dynamicInsert = true, dynamicUpdate = true)
public class UserInfo implements Serializable {
private static final long serialVersionUID = -4855456169220894250L;
@Id
@Column(name = "ID", length = 32)
private String id = java.util.UUID.randomUUID().toString().replaceAll("-", "");
@Column(name = "CREATE_TIME", updatable = false)
private Timestamp createTime = new Timestamp(System.currentTimeMillis());
@Column(name = "UPDATE_TIME", insertable = false)
private Timestamp updateTime = new Timestamp(System.currentTimeMillis());
// setter/getter...
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
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-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
<context:component-scan base-package="com.dao,com.service" />
<context:property-placeholder location="classpath:jdbc.properties" />
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="${jdbc.driver}" />
<property name="jdbcUrl" value="${jdbc.url}" />
<property name="user" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<property name="maxPoolSize" value="50" />
<property name="minPoolSize" value="2" />
<property name="initialPoolSize" value="5" />
<property name="acquireIncrement" value="5" />
<property name="maxIdleTime" value="1800" />
<property name="idleConnectionTestPeriod" value="1800" />
<property name="maxStatements" value="1000"/>
<property name="breakAfterAcquireFailure" value="true" />
<property name="testConnectionOnCheckin" value="true" />
<property name="testConnectionOnCheckout" value="false" />
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFa