如果我用sessionbean的话是不是要将CURD都写到这里。

解决方案 »

  1.   

    myeclipse...可以直接产生相关的DAO
      

  2.   

    恩~应该是eclipse+myeclipse~呵呵
      

  3.   

    我没用过,能说一下产生的DAO都有哪些方法吗?或者简单的列几个看一下
      

  4.   

    private static final Log log = LogFactory.getLog(TCriterionDAO.class);    
        public void save(TCriterion transientInstance) {
            log.debug("saving TCriterion instance");
            try {
                getSession().save(transientInstance);
                log.debug("save successful");
            } catch (RuntimeException re) {
                log.error("save failed", re);
                throw re;
            }
        }
        
    public void delete(TCriterion persistentInstance) {
            log.debug("deleting TCriterion instance");
            try {
                getSession().delete(persistentInstance);
                log.debug("delete successful");
            } catch (RuntimeException re) {
                log.error("delete failed", re);
                throw re;
            }
        }
        
        public TCriterion findById( java.lang.String id) {
            log.debug("getting TCriterion instance with id: " + id);
            try {
                TCriterion instance = (TCriterion) getSession()
                        .get("com.zte.database.data.TCriterion", id);
                return instance;
            } catch (RuntimeException re) {
                log.error("get failed", re);
                throw re;
            }
        }
        
        
        public List findByExample(TCriterion instance) {
            log.debug("finding TCriterion instance by example");
            try {
                List results = getSession()
                        .createCriteria("com.zte.database.data.TCriterion")
                        .add(Example.create(instance))
                .list();
                log.debug("find by example successful, result size: " + results.size());
                return results;
            } catch (RuntimeException re) {
                log.error("find by example failed", re);
                throw re;
            }
        }    
        
        public List findByProperty(String propertyName, Object value) {
          log.debug("finding TCriterion instance with property: " + propertyName
                + ", value: " + value);
          try {
             String queryString = "from TCriterion as model where model." 
              + propertyName + " = " + value ;
             Query queryObject = getSession().createQuery(queryString);
     //queryObject.setParameter(0, value);
     return queryObject.list();
          } catch (RuntimeException re) {
             log.error("find by property name failed", re);
             throw re;
          }
    }    public TCriterion merge(TCriterion detachedInstance) {
            log.debug("merging TCriterion instance");
            try {
                TCriterion result = (TCriterion) getSession()
                        .merge(detachedInstance);
                log.debug("merge successful");
                return result;
            } catch (RuntimeException re) {
                log.error("merge failed", re);
                throw re;
            }
        }    public void attachDirty(TCriterion instance) {
            log.debug("attaching dirty TCriterion instance");
            try {
                getSession().saveOrUpdate(instance);
                log.debug("attach successful");
            } catch (RuntimeException re) {
                log.error("attach failed", re);
                throw re;
            }
        }
        
        public void attachClean(TCriterion instance) {
            log.debug("attaching clean TCriterion instance");
            try {
                getSession().lock(instance, LockMode.NONE);
                log.debug("attach successful");
            } catch (RuntimeException re) {
                log.error("attach failed", re);
                throw re;
            }
        }
      

  5.   

    实习牧师   
    能结合myeclipse 讲的具体些 马 ?
    谢谢 !  线上等  !