hibernate中的session未释放连接 本帖最后由 caonimazige 于 2012-04-17 11:10:18 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 new AnnotationConfiguration().configure().buildSessionFactory(); 创建session的Session session = HiberanateSessionFactory.getSf().getCurrentSession();session.beginTransaction();List list=session.createQuery("from Sys_employee "+where).list();session.beginTransaction().commit();hibernate.cfg.xml<?xml version='1.0' encoding='utf-8'?><!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.driver_class">com.mysql.jdbc.Driver</property> <property name="connection.url">jdbc:mysql://localhost/shangli</property> <property name="connection.username">root</property> <property name="connection.password">123</property> <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <!-- <property name="connection.pool_size">1</property>--> <property name="current_session_context_class">thread</property> <!-- Disable the second-level cache --> <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> <!-- Echo all executed SQL to stdout --> <property name="show_sql">true</property> <property name="format_sql">true</property> <property name="hibernate.hbm2ddl.auto">update</property> <!-- ALl Transcation commit--><!-- <property name="connection.autocommit">true</property>--> <mapping class="com.somelu.hht.entity.Sys_employee"/> <mapping class="com.somelu.hht.entity.FunctionItems"/> <mapping class="com.somelu.hht.entity.Functions"/> <mapping class="com.somelu.hht.entity.RoleToFunction"/> <mapping class="com.somelu.hht.entity.Role"/> <mapping class="com.somelu.hht.entity.RoleToItem"/> </session-factory></hibernate-configuration> mybatis一对一关联插入操作的问题 如何调用其他工程里的某个文件?? 请教jspsmartupload是否支持ftp访问 复制jsp网页到tomcat下出现http status 500错误 想学JSP.需要在电脑上做什么设置? 一个简单的tomcat web应用,读取properties配置文件问题. 链接问题 验证页面弹出框 关于从数据库中读取日期类型的数据的问题。 求一对象方法 JSP的开发中没有像.NET开发中的控件那样的东西吗? 我的网站部署在二级路由下,请问我该如何设置路由,才能在外网访问
session.beginTransaction();
List list=session.createQuery("from Sys_employee "+where).list();
session.beginTransaction().commit();hibernate.cfg.xml
<?xml version='1.0' encoding='utf-8'?>
<!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.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost/shangli</property>
<property name="connection.username">root</property>
<property name="connection.password">123</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- <property name="connection.pool_size">1</property>--> <property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> <!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<!-- ALl Transcation commit-->
<!-- <property name="connection.autocommit">true</property>-->
<mapping class="com.somelu.hht.entity.Sys_employee"/>
<mapping class="com.somelu.hht.entity.FunctionItems"/>
<mapping class="com.somelu.hht.entity.Functions"/>
<mapping class="com.somelu.hht.entity.RoleToFunction"/>
<mapping class="com.somelu.hht.entity.Role"/>
<mapping class="com.somelu.hht.entity.RoleToItem"/>
</session-factory></hibernate-configuration>