KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
My DAO implementation is throwing a not serializable exception on server start up with Tomcat7. Any idea what causes this? None of my other DAOs are doing this. Here's the class: package com.project.dao; import java.util.List; import org.hibernate.SessionFactory; import org.springframework.orm.hibernate3.HibernateTemplate; import com.project.model.User; public class UserDAOImpl implements UserDAO { private HibernateTemplate hibernateTemplate; public void setSessionFactory(SessionFactory sessionFactory) { this.hibernateTemplate = new HibernateTemplate(sessionFactory); } @Override public void saveUser(User user) { hibernateTemplate.saveOrUpdate(user); } @Override @SuppressWarnings("unchecked") public List<User> listUser() { return hibernateTemplate.find("from User"); } @Override @SuppressWarnings("unchecked") public User getUserByID(long userID) { List<User> users= hibernateTemplate.find("from User where id = '" + userID + "'"); return users.size() > 0 ? users.get(0) : null; } } Here's my config: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springfram
Tags (comma-separated)
Save Edits
Cancel