⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 doctypeservice.java

📁 基于hibernate + struts框架 采用mssql数据库,因容量原因,把lib删去了. 由于这是我第一个作品,有很多地方需要改进. 希望大家多提意见. qq: 258268936
💻 JAVA
字号:
package com.hdlb.service;

import java.util.Iterator;
import java.util.List;

import org.hibernate.Query;

import com.hdlb.dao.IDocType;
import com.hdlb.factory.DAOFactory;
import com.hdlb.hibernate.TDoctype;

public class DocTypeService implements IDocTypeService {

	public List getDocType() {
		IDocType doctype = DAOFactory.getDocTypeDAO();
		List list = doctype.createQuery("from TDoctype doctype")
				.list();
		return list;
	}

	public String getDocTypeById(int id) {//bang ni gai jin xia dai ma.xing ma?
		
		System.out.println("in DocTypeService getDocTypeById method");
		IDocType doctypeDAO = DAOFactory.getDocTypeDAO();
		String queryString = "select doctype from TDoctype doctype where doctype.fid=?";
		try {
			Query q = doctypeDAO.createQuery(queryString);
			q.setInteger(0,id);
			TDoctype dt = new TDoctype();
			dt = (TDoctype)q.list().get(0);
			return dt.getFtypename();
		} catch (Exception e) {
			/*
			 * if(){
			 * }else{
			 * }
			 * */
			e.printStackTrace();

		}
		return null;
		
		
//		Query q =	doctypeDAO.createQuery("select doctype from TDoctype doctype where doctype.fid=?");
//		q.setInteger(0,id);
//		List names = q.list();//这里错了
//		Iterator iterator = names.iterator();
//		String type = "";
//		while(iterator.hasNext()) {
//			TDoctype doctype = (TDoctype) iterator.next();
//			type = doctype.getFtypename();
//		    System.out.println(doctype.getFid() + "\t" + doctype.getFtypename());
//		}

	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -