日期:2014-05-20 浏览次数:20932 次
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <property name="driverClass" value="com.mysql.jdbc.Driver"></property> <property name="jdbcUrl"> <value>jdbc:mysql://localhost/icrom?useUnicode=true&characterEncoding=utf-8</value> </property> <property name="user"> <value>root</value> </property> <property name="password"> <value>12345678</value> </property> <property name="minPoolSize"> <value>5</value> </property> <property name="maxPoolSize"> <value>30</value> </property> <property name="initialPoolSize"> <value>10</value> </property> <property name="maxIdleTime"> <value>60</value> </property> <property name="acquireIncrement"> <value>3</value> </property> <property name="maxStatements"> <value>0</value> </property> <property name="maxStatementsPerConnection"> <value>0</value> </property> <property name="idleConnectionTestPeriod"> <value>28680</value> </property> <property name="acquireRetryAttempts"> <value>30</value> </property> <property name="breakAfterAcquireFailure"> <value>false</value> </property> <property name="testConnectionOnCheckout"> <value>false</value> </property> </bean>
public AbstractPersistentObject findById(Class<?> klass, Integer id) { log.debug("getting " + klass.getName() + " instance with id: " + id); try { AbstractPersistentObject instance = (AbstractPersistentObject) getHibernateTemplate() .get(klass, id); return instance; } catch (RuntimeException re) { log.error("get failed", re); throw re; } }