資源簡介
beats html5前端頁面,h5特效,炫酷、簡潔、大方的界面設計 。歡迎下載?。。?!
代碼片段和文件信息
package?net.earphoneproject.entity;
import?org.hibernate.HibernateException;
import?org.hibernate.Session;
import?org.hibernate.cfg.Configuration;
/**
?*?Configures?and?provides?access?to?Hibernate?sessions?tied?to?the
?*?current?thread?of?execution.??Follows?the?Thread?Local?Session
?*?pattern?see?{@link?http://hibernate.org/42.html?}.
?*/
public?class?HibernateSessionFactory?{
????/**?
?????*?Location?of?hibernate.cfg.xml?file.
?????*?Location?should?be?on?the?classpath?as?Hibernate?uses??
?????*?#resourceAsStream?style?lookup?for?its?configuration?file.?
?????*?The?default?classpath?location?of?the?hibernate?config?file?is?
?????*?in?the?default?package.?Use?#setConfigFile()?to?update?
?????*?the?location?of?the?configuration?file?for?the?current?session.???
?????*/
????private?static?String?CONFIG_FILE_LOCATION?=?“/hibernate.cfg.xml“;
private?static?final?ThreadLocal?threadLocal?=?new?ThreadLocal();
????private??static?Configuration?configuration?=?new?Configuration();????
????private?static?org.hibernate.SessionFactory?sessionFactory;
????private?static?String?configFile?=?CONFIG_FILE_LOCATION;
static?{
???? try?{
configuration.configure(configFile);
sessionFactory?=?configuration.buildSessionFactory();
}?catch?(Exception?e)?{
System.err
.println(“%%%%?Error?Creating?SessionFactory?%%%%“);
e.printStackTrace();
}
????}
????private?HibernateSessionFactory()?{
????}
/**
?????*?Returns?the?ThreadLocal?Session?instance.??Lazy?initialize
?????*?the?SessionFactory
?if?needed.
?????*
?????*??@return?Session
?????*??@throws?HibernateException
?????*/
????public?static?Session?getSession()?throws?HibernateException?{
????????Session?session?=?(Session)?threadLocal.get();
if?(session?==?null?||?!session.isOpen())?{
if?(sessionFactory?==?null)?{
rebuildSessionFactory();
}
session?=?(sessionFactory?!=?null)???sessionFactory.openSession()
:?null;
threadLocal.set(session);
}
????????return?session;
????}
/**
?????*??Rebuild?hibernate?session?factory
?????*
?????*/
public?static?void?rebuildSessionFactory()?{
try?{
configuration.configure(configFile);
sessionFactory?=?configuration.buildSessionFactory();
}?catch?(Exception?e)?{
System.err
.println(“%%%%?Error?Creating?SessionFactory?%%%%“);
e.printStackTrace();
}
}
/**
?????*??Close?the?single?hibernate?session?instance.
?????*
?????*??@throws?HibernateException
?????*/
????public?static?void?closeSession()?throws?HibernateException?{
????????Session?session?=?(Session)?threadLocal.get();
????????threadLocal.set(null);
????????if?(session?!=?null)?{
????????????session.close();
????????}
????}
/**
?????*??return?session?factory
?????*
?????*/
public?static?org.hibernate.SessionFactory?getSessionFactory()?{
return?sessionFactory;
}
/**
?????*??return?session?factory
?????*
?????* session?factory?will?be?rebuilded?in?the?next?call
?????*/
public?static?void?setConfigFile(String?confi
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????880??2017-05-02?19:23??耳機網頁面\EarphoneProjectOne\.classpath
?????文件????????581??2016-12-14?15:47??耳機網頁面\EarphoneProjectOne\.myhibernatedata
?????文件????????327??2016-12-14?15:31??耳機網頁面\EarphoneProjectOne\.myme
?????文件???????1747??2016-12-14?15:47??耳機網頁面\EarphoneProjectOne\.project
?????文件????????500??2016-12-14?15:32??耳機網頁面\EarphoneProjectOne\.settings\.jsdtscope
?????文件????????158??2016-12-14?15:33??耳機網頁面\EarphoneProjectOne\.settings\com.genuitec.eclipse.core.prefs
?????文件?????????66??2017-05-02?19:10??耳機網頁面\EarphoneProjectOne\.settings\org.eclipse.core.resources.prefs
?????文件????????395??2016-12-14?15:30??耳機網頁面\EarphoneProjectOne\.settings\org.eclipse.jdt.core.prefs
?????文件????????492??2016-12-14?15:30??耳機網頁面\EarphoneProjectOne\.settings\org.eclipse.wst.common.component
?????文件????????252??2016-12-14?15:31??耳機網頁面\EarphoneProjectOne\.settings\org.eclipse.wst.common.project.facet.core.xm
?????文件?????????49??2016-12-14?15:31??耳機網頁面\EarphoneProjectOne\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件??????????6??2016-12-14?15:31??耳機網頁面\EarphoneProjectOne\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????文件????????846??2016-12-14?15:47??耳機網頁面\EarphoneProjectOne\src\hibernate.cfg.xm
?????文件???????3227??2016-12-14?15:47??耳機網頁面\EarphoneProjectOne\src\net\earphoneproject\entity\HibernateSessionFactory.java
?????文件???????3228??2016-12-11?20:38??耳機網頁面\EarphoneProjectOne\WebRoot\css\skin_default.css
?????文件?????164718??2016-12-12?01:04??耳機網頁面\EarphoneProjectOne\WebRoot\css\st
?????文件??????36504??2016-12-11?20:38??耳機網頁面\EarphoneProjectOne\WebRoot\css\weiboShow.css
?????文件??????66250??2016-12-12?02:57??耳機網頁面\EarphoneProjectOne\WebRoot\images\1-inear-tour2-black-standard-front-O.png
?????文件??????65152??2016-12-12?02:57??耳機網頁面\EarphoneProjectOne\WebRoot\images\1-inear-tour2-black-standard-side-O.png
?????文件??????73037??2016-12-12?02:57??耳機網頁面\EarphoneProjectOne\WebRoot\images\1-inear-tour2-black-standard-thrqrtleft-O.png
?????文件??????85013??2016-12-12?02:57??耳機網頁面\EarphoneProjectOne\WebRoot\images\1-inear-tour2-black-standard-thrqrtright-O.png
?????文件??????53651??2016-12-12?02:57??耳機網頁面\EarphoneProjectOne\WebRoot\images\1-inear-tour2-black-standard-wingtips-NOBADGE-O.png
?????文件??????91142??2016-12-12?02:57??耳機網頁面\EarphoneProjectOne\WebRoot\images\1-inear-tour2-black-thumb-thrqtrrev-O.png
?????文件?????183184??2016-12-11?20:38??耳機網頁面\EarphoneProjectOne\WebRoot\images\1.jpg
?????文件???????1097??2016-12-12?02:33??耳機網頁面\EarphoneProjectOne\WebRoot\images\1.png
?????文件??????58366??2016-12-11?20:38??耳機網頁面\EarphoneProjectOne\WebRoot\images\1387923219881933814.jpg
?????文件??????55685??2016-12-11?20:38??耳機網頁面\EarphoneProjectOne\WebRoot\images\1387924854314872995.jpg
?????文件??????82514??2016-12-11?20:38??耳機網頁面\EarphoneProjectOne\WebRoot\images\1387925117371660903.jpg
?????文件??????75027??2016-12-11?20:38??耳機網頁面\EarphoneProjectOne\WebRoot\images\1387925256092255571.jpg
?????文件??????77148??2016-12-11?20:38??耳機網頁面\EarphoneProjectOne\WebRoot\images\1387925481176748304.jpg
............此處省略179個文件信息
- 上一篇:X-scan軟件
- 下一篇:stm32f107 web server
評論
共有 條評論