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

📄 cdtypedaoimpl.java

📁 用jsf实现cd商店的程序
💻 JAVA
字号:
package com.tangjun.data.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.tangjun.data.ICDTypeDao;
import com.tangjun.web.pojo.CD;
import com.tangjun.web.pojo.CDType;

public class CDTypeDaoImpl extends HibernateDaoSupport implements ICDTypeDao
{

	public boolean addType(CDType cdType)
	{
		this.getHibernateTemplate().save(cdType);
		return false;
	}

	public boolean delType(Integer id)
	{
		CDType cdType=(CDType)this.getHibernateTemplate().load(CDType.class,id);
		this.getHibernateTemplate().delete(cdType);
		return false;
	}

	public CDType findTypeById(Integer id)
	{
		String hql="from CDType ct where id=?";		
		List types=this.getHibernateTemplate().find(hql,id);
		if(types.size()==1)
			return (CDType)types.get(0);
		return null;
	}

	public List getAllType()
	{
		String hql="from CDType cdt";
		return this.getHibernateTemplate().find(hql);
	}

	public boolean updateType(CDType cdType)
	{
		// TODO 自动生成方法存根
		return false;
	}
	
	public List getAllTypes()
	{
		String hql="select cdt.typeName from CDType as cdt";
		return this.getHibernateTemplate().find(hql);
	}
}

⌨️ 快捷键说明

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