• 大小: 6.52M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2020-12-27
  • 语言: Java
  • 标签: 数据库  Hibernate  

资源简介

map方式hibernate连接数据库代码,精简,高效。

资源截图

代码片段和文件信息

package com.abchina.test.hibernate.common;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;


public class HibernateUtil {
private static Log log = LogFactory.getLog(HibernateUtil.class);
private static SessionFactory sessionFactory;
static{
try{
sessionFactory = new Configuration().configure().buildSessionFactory();
}catch(Exception e){
log.error(“Init sessionFactory failed!“e);
System.out.println(“Init sessionFactory failed!“ + e);
}
}

public static final ThreadLocal session = new ThreadLocal();

public static Session CurrentSession() throws HibernateExcepti

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-11-13 08:49  hibernate4-map-20150102\
     文件         558  2015-01-02 20:41  hibernate4-map-20150102\.classpath
     文件        1075  2015-01-02 20:41  hibernate4-map-20150102\.project
     目录           0  2015-11-13 08:49  hibernate4-map-20150102\.settings\
     文件          57  2015-01-02 20:41  hibernate4-map-20150102\.settings\org.eclipse.core.resources.prefs
     文件         330  2015-01-02 20:41  hibernate4-map-20150102\.settings\org.eclipse.jdt.core.prefs
     文件         364  2015-01-02 20:41  hibernate4-map-20150102\.settings\org.eclipse.jst.common.project.facet.core.prefs
     文件         602  2015-01-02 20:41  hibernate4-map-20150102\.settings\org.eclipse.wst.common.component
     文件         269  2015-01-02 20:41  hibernate4-map-20150102\.settings\org.eclipse.wst.common.project.facet.core.xml
     目录           0  2015-11-13 08:49  hibernate4-map-20150102\WebContent\
     目录           0  2015-11-13 08:49  hibernate4-map-20150102\WebContent\meta-INF\
     文件          39  2015-01-02 20:41  hibernate4-map-20150102\WebContent\meta-INF\MANIFEST.MF
     目录           0  2015-11-13 08:49  hibernate4-map-20150102\WebContent\WEB-INF\
     目录           0  2015-11-13 08:49  hibernate4-map-20150102\WebContent\WEB-INF\lib\
     文件      445288  2015-01-02 20:41  hibernate4-map-20150102\WebContent\WEB-INF\lib\antlr-2.7.7.jar
     文件       60686  2015-01-02 20:41  hibernate4-map-20150102\WebContent\WEB-INF\lib\commons-logging-1.1.1.jar
     文件      313898  2015-01-02 20:41  hibernate4-map-20150102\WebContent\WEB-INF\lib\dom4j-1.6.1.jar
     文件       81271  2015-01-02 20:41  hibernate4-map-20150102\WebContent\WEB-INF\lib\hibernate-commons-annotations-4.0.1.Final.jar
     文件     4414476  2015-01-02 20:41  hibernate4-map-20150102\WebContent\WEB-INF\lib\hibernate-core-4.1.4.Final.jar
     文件      477528  2015-01-02 20:41  hibernate4-map-20150102\WebContent\WEB-INF\lib\hibernate-entitymanager-4.1.4.Final.jar
     文件      102661  2015-01-02 20:41  hibernate4-map-20150102\WebContent\WEB-INF\lib\hibernate-jpa-2.0-api-1.0.1.Final.jar
     文件      714195  2015-01-02 20:41  hibernate4-map-20150102\WebContent\WEB-INF\lib\javassist-3.18.1-GA.jar
     文件       57193  2015-01-02 20:41  hibernate4-map-20150102\WebContent\WEB-INF\lib\jboss-logging-3.1.4.GA.jar
     文件       15071  2015-01-02 20:41  hibernate4-map-20150102\WebContent\WEB-INF\lib\jta-1.1.jar
     文件      703265  2015-01-02 20:41  hibernate4-map-20150102\WebContent\WEB-INF\lib\mysql-connector-java-5.1.6.jar
     文件       25496  2015-01-02 20:41  hibernate4-map-20150102\WebContent\WEB-INF\lib\slf4j-api-1.6.1.jar
     文件        8869  2015-01-02 20:41  hibernate4-map-20150102\WebContent\WEB-INF\lib\slf4j-log4j12-1.7.5.jar
     文件         287  2015-01-02 20:41  hibernate4-map-20150102\WebContent\WEB-INF\web.xml
     目录           0  2015-11-13 08:49  hibernate4-map-20150102\build\
     目录           0  2015-11-13 08:49  hibernate4-map-20150102\build\classes\
     目录           0  2015-11-13 08:49  hibernate4-map-20150102\build\classes\com\
............此处省略69个文件信息

评论

共有 条评论