InfoDAOImpl

package com.huaweisymantec.rmc.core.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Component;

import com.huaweisymantec.rmc.core.dao.InfoDAO;
import com.huaweisymantec.rmc.core.domain.Info;
import com.huaweisymantec.rmc.core.domain.RemoteClientPoint;

@Component
public class InfoDAOImpl implements InfoDAO{


    private HibernateTemplate ht;

public HibernateTemplate getHt() {
return ht;
}

@Resource
public void setHt(HibernateTemplate ht) {
this.ht = ht;
}

public Info findInfo(String ESN) {
List list=ht.find("from Info where ESN=?",ESN);
if(list.size()>0)
{
return (Info)list.get(0);
}
else
{
return null;
}
}

public void saveInfo(Info info) {

ht.save(info);

}

public Info  getInfo(String esn) {
List<Info> infos = ht.find("from Info   where esn='" + esn+ "'");
return infos.get(0);
}
}

你可能感兴趣的:(DAO,orm)