spring_ioc.xml:
<bean id="SssionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
hibernate.cfg.xml
<?xml version='1.0' encoding='gbk'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.username">aa</property>
<property name="connection.url">
jdbc:oracle:thin:@192.168.0.100:1521:ht
</property>
<property name="dialect">
org.hibernate.dialect.Oracle9Dialect
</property>
<property name="myeclipse.connection.profile">test</property>
<property name="connection.password">test<property>
<property name="connection.driver_class">
oracle.jdbc.driver.OracleDriver
</property>
<mapping resource="com/htky/po/TabUser.hbm.xml" />
</session-factory>
</hibernate-configuration>
DAO查询:
public List<TabUser> getAllUser() {
Session session = getSession();
String hql = "from TabUser where blLockFlag = 1 order by ownerSite";
Query query = session.createQuery(hql);
List list = query.list();
releaseSession(session);
return list;
}
我用的spring定时器,服务器启动以后第一次程序运行成功,定时1小时后自动运行程序报上面的错! List list = query.list();
这行出错。