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

📄 persondaoimpl.java

📁 该项目基于mvc模式
💻 JAVA
字号:
package com.sunny.test.dao.impl;

import java.util.List;

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

import com.sunny.test.dao.PersonDao;
import com.sunny.test.model.Person;

public class PersonDaoImpl extends HibernateDaoSupport implements PersonDao
{

	
	public void delete(int id) throws Exception
	{
		this.getHibernateTemplate().delete(getPerson(id));

	}

	
	public List findAll() throws Exception
	{
		List all = null;
		String hql = "from Person a,City b,Province c where a.cityId=b.id and a.provinceId=c.id order by b.id";
		all = getHibernateTemplate().find(hql);
		return all;
	}

	
	public Person getPerson(int id) throws Exception
	{
		Person person = null;
	    person = (Person)this.getHibernateTemplate().get(com.sunny.test.model.Person.class, id);
		return person;
	}

	
	public void save(Person person) throws Exception
	{
		this.getHibernateTemplate().saveOrUpdate(person);

	}

}

⌨️ 快捷键说明

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