📄 carmanager.java
字号:
package com.gzrealmap.oa.car.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.car.*;
import com.gzrealmap.lib.hibernate.HibernateUtil;
import java.io.*;
public class CarManager {
public CarManager() {
}
public static void addCar(CarBean newCar) throws Exception {
HibernateUtil theHibernateUtil = HibernateUtil.getInstance();
theHibernateUtil.create2Db(newCar);
}
public static CarBean findCar(Integer obj) throws Exception {
HibernateUtil theHibernateUtil = HibernateUtil.getInstance();
return (CarBean) theHibernateUtil.findByPrimaryKey(CarBean.class,
obj);
}
public static void updateCar(CarBean theUpdateCar) throws
Exception {
HibernateUtil theHibernateUtil = HibernateUtil.getInstance();
theHibernateUtil.update2Db(theUpdateCar);
}
public static void removeCar(CarBean theRemoveCar) throws
Exception {
HibernateUtil theHibernateUtil = HibernateUtil.getInstance();
theHibernateUtil.remove4Db(theRemoveCar);
}
/* public static void main(String[] args) throws Exception{
new DriverManager();
CarBean driver = new CarBean();
driver.setCarID(111);
driver.setCarNo("123");
driver.setCarType("123");
driver.setBuyTime("111");
addCar(driver);
}
*/
/**
* 增加一个CarApp
*/
public static void addCarApp(CarAppBean newCarApp) throws Exception {
HibernateUtil theHibernateUtil = HibernateUtil.getInstance();
theHibernateUtil.create2Db(newCarApp);
}
public static void addCarApp2Car(CarBean theOneInDataBase, CarAppBean theNewMany)
throws Exception {
theOneInDataBase.addCarApp(theNewMany);
theNewMany.setCarID(theOneInDataBase);
addCarApp(theNewMany);
updateCar(theOneInDataBase);
}
/**
* 增加一个CarMaintain
*/
public static void addCarMaintain(CarMaintainBean newCarMaintain) throws Exception {
HibernateUtil theHibernateUtil = HibernateUtil.getInstance();
theHibernateUtil.create2Db(newCarMaintain);
}
public static void addCarMaintainp2Car(CarBean theOneInDataBase, CarMaintainBean theNewMany)
throws Exception {
theOneInDataBase.addCarMaintain(theNewMany);
theNewMany.setCarNo(theOneInDataBase);
addCarMaintain(theNewMany);
updateCar(theOneInDataBase);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -