📄 bookmanager.java
字号:
package com.gzrealmap.oa.book.business;
/**
* <p>Title: RealOA</p>
* <p>Description: RealOA</p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: gzrealmap.com</p>
* @author not attributable
* @version 1.0
*/
import com.gzrealmap.oa.book.*;
import com.gzrealmap.lib.hibernate.HibernateUtil;
import java.io.*;
import java.util.*;
public class BookManager {
public BookManager() {
}
public static void addBook(BookBean newBook) throws Exception {
HibernateUtil theHibernateUtil = HibernateUtil.getInstance();
theHibernateUtil.create2Db(newBook);
}
public static BookBean findBook(Integer obj) throws Exception {
HibernateUtil theHibernateUtil = HibernateUtil.getInstance();
return (BookBean) theHibernateUtil.findByPrimaryKey(BookBean.class,
obj);
}
public static void updateBook(BookBean theUpdateBook) throws
Exception {
HibernateUtil theHibernateUtil = HibernateUtil.getInstance();
theHibernateUtil.update2Db(theUpdateBook);
}
public static void removeBook(BookBean theRemoveBook) throws
Exception {
HibernateUtil theHibernateUtil = HibernateUtil.getInstance();
theHibernateUtil.remove4Db(theRemoveBook);
}
/**
* 增加一个event
*/
public static void addBookLend(BookLendBean newBookLend) throws Exception {
HibernateUtil theHibernateUtil = HibernateUtil.getInstance();
theHibernateUtil.create2Db(newBookLend);
}
public static void addBookLend2Book(BookBean theOneInDataBase, BookLendBean theNewMany) throws Exception {
theOneInDataBase.addBookLend(theNewMany);
theNewMany.setLoginID(theOneInDataBase);
addBookLend(theNewMany);
updateBook(theOneInDataBase);
}
/*public static void addBookLend2Book(BookBean theOneInDataBase, BookLendBean theNewMany) throws Exception {
theOneInDataBase.addBookLend(theNewMany);
theNewMany.setBook(theOneInDataBase);
addBookLend(theNewMany);
updateCalendar(theOneInDataBase);
}*/
/**public static void main(String[] args) throws Exception{
HibernateUtil theHibernateUtil = HibernateUtil.getInstance();
Session session = theHibernateUtil.connect();
Transaction tran = null;
try {
tran = session.beginTransaction();
BookBean newBook = new BookBean();
newBook.setLoginID(11);
newBook.setName("bb");
session.save(newBook);
BookLendBean theLendBean = new BookLendBean();
theLendBean.setBookLendID(66);
theLendBean.setUserID(77);
theLendBean.setLoginID(newBook);
newBook.addBookLend(theLendBean);
session.save(theLendBean);
tran.commit();
}
catch (HibernateException ex) {
tran.rollback();
}
session.close();
System.out.println("ok");
}
*/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -