欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
ssh下基于JUnit測試出現的延遲加載的解決方案
Spring+Hibernate延遲加載測試基類(lèi)  
  
import junit.framework.TestCase;   
  
import org.hibernate.Session;   
import org.hibernate.SessionFactory;   
import org.junit.AfterClass;   
import org.springframework.context.ApplicationContext;   
import org.springframework.context.support.FileSystemXmlApplicationContext;   
import org.springframework.orm.hibernate3.SessionFactoryUtils;   
import org.springframework.orm.hibernate3.SessionHolder;   
import org.springframework.transaction.support.TransactionSynchronizationManager;   
  
public abstract class AbstractTest extends TestCase{   
  
    private static SessionFactory sessionFactory ;   
    private static ApplicationContext ctx;   
  
    public void setUp() throws Exception {    
       ctx= new ClassPathXmlApplicationContext("applicationContext.xml");   
        sessionFactory = (SessionFactory) getBean("sessionFactory");   
        Session s = sessionFactory.openSession();   
        TransactionSynchronizationManager.bindResource(sessionFactory,   
                new SessionHolder(s));   
    }   
  
    protected static Object getBean(String beanName) {   
        return ctx.getBean(beanName);   
    }   
  
    public void tearDown() throws Exception {   
        SessionHolder holder = (SessionHolder) TransactionSynchronizationManager   
                .getResource(sessionFactory);   
        Session s = holder.getSession();   
        s.flush();   
        TransactionSynchronizationManager.unbindResource(sessionFactory);   
        SessionFactoryUtils.closeSession(holder.getSession());   
    }   
}  
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
junit測試之hiberante延遲加載問(wèn)題(Could not obtain transaction-synchronized Session for current threa
OpenSessionInViewFilter源碼分析
Spring源代碼解析(八):Spring驅動(dòng)Hibernate的實(shí)現
hibernate4 二級緩存demo實(shí)例
Hibernate 官方單例獲取sessionFactoty
關(guān)于OpenSessionInViewFilter
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久