junit 安装 springmvc+hibernate(11)

电脑杂谈  发布时间:2018-02-07 19:32:08  来源:网络整理

this.telephone = telephone;

}

@Temporal(TemporalType.TIMESTAMP)

@Column(name = "register_time", length = 19)

public Date getRegisterTime() {

return this.registerTime;

}

public void setRegisterTime(Date registerTime) {

this.registerTime = registerTime;

}

}

接口自己处理

package com.dao.impl;

import java.util.List;

import org.hibernate.Session;

import org.hibernate.SessionFactory;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Repository;

import com.dao.UserDao;

import com.entity.AcctUser;

@Repository("userDao")

public class UserDaoImpl implements UserDao {

@Autowired

private SessionFactory sessionFactory;

private Session getCurrentSession() {

return this.sessionFactory.getCurrentSession();

}

public AcctUser load(String id) {

return (AcctUser) this.getCurrentSession().load(AcctUser.class, id);

}

public AcctUser get(String id) {

junit4_测试用例设计书_junit 安装

return (AcctUser) this.getCurrentSession().get(AcctUser.class, id);

}

@SuppressWarnings("unchecked")

public List<AcctUser> findAll() {

List<AcctUser> acctUsers = this.getCurrentSession().createQuery("from AcctUser").setCacheable(true).list();

return acctUsers;

}

public void delete(String id) {

AcctUser entity = this.load(id);

this.getCurrentSession().delete(entity);

}

public void flush() {

this.getCurrentSession().flush();

}

public String save(AcctUser entity) {

return (String) this.getCurrentSession().save(entity);

}

}

package com.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;


本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/ruanjian/article-65857-11.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...