factory.java
来自「图书馆管理系统,用java编写,有原码,有检索,查询,修改,删除等功能」· Java 代码 · 共 37 行
JAVA
37 行
package com.autumn.pojo.oper;
import org.hibernate.Session;
import org.hibernate.cfg.Configuration;
public class Factory {
private static Session session = null ;
public static BookOper getBookOperInstance()
{
return new BookOper() ;
}
public static BorrowedOper getBorrowedOperInstance()
{
return new BorrowedOper() ;
}
public static ManagerOper getManagerOperIntance()
{
return new ManagerOper() ;
}
public static ReaderOper getReaderOperIntance()
{
return new ReaderOper() ;
}
public static HistoryOper getHistoryOperInstance()
{
return new HistoryOper() ;
}
public static Session getSession()
{
if(session==null||!session.isOpen()){
session=new Configuration().configure().buildSessionFactory().openSession();
}
return session ;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?