com.jwn.dao.UsersDAO.findByProperty(UsersDAO.java:168)你发的是 public class UrlDAO extends BaseHibernateDAO
解决方案 »
- Hibernate左连接left join fetch报错
- ssh面试题strutsspringhibernate面试题it 分类
- jfreechart与表格同步刷新问题
- Hibernate调试错误,怎么解决?
- [讨论]容器启动后,会有几个servlet实例?
- java.lang.NoClassDefFoundError: org/jaxen/BaseXPath 使用idea时候遇到的问题
- 实体Bean和sqlserver连接出现的问题,紧急求救~~~
- tomcat连接池。。。网页上使用可以,直接在类里运行不可以
- !急!几个菜鸟级别的WebServices问题!
- spring mvc 注解:No bean named 'userBiz' is defined
- 如何在hibernate中用代码实现sqlserver2000按字段顺序查询?
- 超链接在传递带有&符号的字符串时不能正常显示
出這種錯 大概都是配置數據源寫錯 或 驅動包壞掉勒------------------------------------
suyu_001
勇者无谓
等 级:
发表于:2007-10-30 10:27:174楼 得分:0 我们组 做工程一直用这个 驱动包
应该不是这个问提
這可不一定的,有時候驅動包特容易壞。
--------------------------------------
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.criterion.Example;import com.jwn.model.Col;
import com.jwn.model.Users;/**
* Data access object (DAO) for domain model class Users.
* @see .Users
* @author MyEclipse - Hibernate Tools
*/
public class UsersDAO extends BaseHibernateDAO { private static final Log log = LogFactory.getLog(UsersDAO.class); //property constants
public static final String REAL_NAME = "realName";
public static final String USER_NAME = "userName";
public static final String USER_PWD = "userPwd";
public static final String USER_DUTY = "userDuty";
public static final String USER_PIC = "userPic";
public static final String USER_BIRTHDAY = "userBirthday";
public static final String USER_PHONE = "userPhone";
public static final String USER_MPHONE = "userMphone";
public static final String USER_PRO = "userPro";
public static final String USER_SCHOOL = "userSchool";
public static final String USER_OEMAIL = "userOemail";
public static final String USER_IEMAIL = "userIemail";
public static final String USER_JL = "userJl";
public void save(Users transientInstance) {
log.debug("saving Users instance");
try {
getSession().save(transientInstance);
getSession().flush();
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(Users persistentInstance) {
log.debug("deleting Users instance");
try {
getSession().delete(persistentInstance);
getSession().flush();
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Users findById( java.lang.Long id) {
log.debug("getting Users instance with id: " + id);
try {
Users instance = (Users) getSession()
.get(Users.class, id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public Users findMaxPicName(){
log.debug("getting Col instance with MaxPicName ");
try {
Users user = null;
List list = getSession().createQuery("from Users where user_pic!='' order by user_pic desc").list();
if(list.size()>0){
user = (Users)list.get(0);
}
return user;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(Users instance) {
log.debug("finding Users instance by example");
try {
List results = getSession()
.createCriteria(Users.class)
.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 findAllUsersByDuty(String p_str_duty){
log.debug("getting duty Users instance with duty: " + p_str_duty);
try {
List list = getSession().createQuery("from Users where user_duty like '" + p_str_duty + "%' order by user_duty asc").list();
return list;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findAllLeader(){
log.debug("getting all leader");
try {
List list = getSession().createQuery("from Users where user_duty like '99%' ORDER BY user_duty asc").list();
return list;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public String findMaxLeaderUrl(){
log.debug("getting Max Leader Url ");
String maxLeaderUrl = "";
try {
List list = getSession().createQuery("from Users where user_duty like '99%' ORDER BY user_duty desc").list();
if(!list.isEmpty()){
maxLeaderUrl =((Users)list.get(0)).getUserDuty();
}
return maxLeaderUrl;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding Users instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Users as model where model."
+ propertyName + "= ?";
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;
}
}谢谢 大家了
不过还是不行 并不是连不上,重起tomcat就能连上 但到第二天就连不上了!
還是tomcat會關閉,第二天就連不上?
還是當天tomcat關閉,打開,關閉打開都能連,但就是到勒第二天連不上? 你回想下是不是改過什么東西? 你這個錯誤信息是在做什么操作的時候出現的?
没该什么东西 现在 这工程在跑着 但就是 一天地重起一次也不是初始化的问题 重起tomcat就好了
session 也关闭了! 这个错误出现在登陆的时候 验证用户时候用
再 帮我想想 办法 谢谢楼上了!!!!!:):):):):):):):):):):)
因為說到這樣,我也想不出來是什么原因,90%應該是環境問題吧。
再問一下:難道當天就可以完全正常運行,不關tomcat,到第二天登錄時就連不上服務器?
然后重啟tomcat就又可以正常運行一天?再說說你登錄工作后,一般會讀DB進行多少的操作,如upt,add,del 順便說一句:上面的代碼我不看,沒重點,看頭暈。