AdapterDao.java
资源名称:Appjxc.rar [点击查看]
上传用户:whbcdz
上传日期:2008-08-04
资源大小:7683k
文件大小:3k
源码类别:
JavaScript
开发平台:
Java
- package appjxc.dao;
- import org.springframework.beans.factory.xml.XmlBeanFactory;
- import org.springframework.core.io.ClassPathResource;
- import org.springframework.core.io.Resource;
- import appjxc.model.*;
- import java.util.List;
- import org.springframework.orm.hibernate3.SessionFactoryUtils;
- import javax.swing.JOptionPane;
- import appjxc.view.JF_view_error;
- public class AdapterDao {
- private Resource resource = null;
- private XmlBeanFactory factory = null;
- private static DaoSupport dao = null;
- public AdapterDao(){
- // getdao();
- }
- public boolean getdao(){
- try{
- this.resource = new ClassPathResource("appcontext.xml");
- System.out.println("resourc = " + resource);
- this.factory = new XmlBeanFactory(resource);
- System.out.println("factory = " + factory);
- this.dao = (DaoSupport) factory.getBean("DAOProxy");
- System.out.println("dao = " + dao);
- //JOptionPane.showMessageDialog(null,"初始化数据成功!!!","系统提示",JOptionPane.INFORMATION_MESSAGE);
- return true;
- }catch(Exception e){
- e.printStackTrace();
- System.out.println("Erro; = " + e.getMessage());
- JF_view_error error = new JF_view_error(e.getMessage());
- error.setTitle("初始化数据连接失败,错误信息如下:");
- return false;
- //JOptionPane.showMessageDialog(null,"初始化数据失败,错误信息如下:n" + e.getMessage(),"系统提示",JOptionPane.INFORMATION_MESSAGE);
- }
- }
- public static boolean insertmedicine(obj_medicine medicine){
- return dao.InsertMedicine(medicine);
- }
- public static boolean insertclient(Obj_client objclient){
- return dao.InsertClient(objclient);
- }
- public static boolean insertmedicine(Obj_gys objgys){
- return dao.InsertMedicine(objgys);
- }
- public static boolean InsertSellMain(Obj_SellMain obj){
- return dao.InsertSellMain(obj);
- }
- public static boolean InsertSellDetaile(Obj_SellDetaile obj){
- return dao.InsertSellDetaile(obj);
- }
- public static boolean InsertBuyMain(Obj_BuyMain obj){
- return dao.InsertBuyMain(obj);
- }
- public static boolean InsertBuyDetaile(Obj_BuyDetaile obj){
- return dao.InsertBuyDetaile(obj);
- }
- public static boolean InsertStock(Obj_Stock obj){
- return dao.InsertStock(obj);
- }
- public static boolean InsertObj_SellDetaileTh(Obj_SellDetaileTh obj){
- return dao.InsertObj_SellDetaileTh(obj);
- }
- public static boolean InsertObj_UserName(Obj_UserName obj){
- return dao.InsertObj_UserName(obj);
- }
- public static List QueryObject(String str){
- return dao.QueryObject(str);
- }
- public static void DeleteUser(Obj_UserName user){
- dao.DeleteUser(user);
- }
- }