com.gisgraphy.dao.hibernate
Class UserDaoHibernate
java.lang.Object
org.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate3.support.HibernateDaoSupport
com.gisgraphy.dao.hibernate.GenericDaoHibernate<User,java.lang.Long>
com.gisgraphy.dao.hibernate.UserDaoHibernate
- All Implemented Interfaces:
- GenericDao<User,java.lang.Long>, UserDao, org.acegisecurity.userdetails.UserDetailsService, org.springframework.beans.factory.InitializingBean
public class UserDaoHibernate
- extends GenericDaoHibernate<User,java.lang.Long>
- implements UserDao, org.acegisecurity.userdetails.UserDetailsService
This class interacts with Spring's HibernateTemplate to save/delete and
retrieve User objects.
- Author:
- Matt Raible Modified by
Dan Kibler Extended to
implement Acegi UserDetailsService interface by David Carter
david@carter.net Modified by Bryan
Noll to work with the new BaseDaoHibernate implementation that
uses generics.
Fields inherited from class org.springframework.dao.support.DaoSupport |
logger |
Constructor Summary |
UserDaoHibernate()
Constructor that sets the entity to User.class. |
Method Summary |
java.util.List<User> |
getUsers()
Gets a list of users ordered by the uppercase version of their username. |
org.acegisecurity.userdetails.UserDetails |
loadUserByUsername(java.lang.String username)
Gets users information based on login name. |
User |
save(User user)
Overridden simply to call the saveUser method. |
User |
saveUser(User user)
Saves a user's information. |
Methods inherited from class org.springframework.orm.hibernate3.support.HibernateDaoSupport |
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory |
Methods inherited from class org.springframework.dao.support.DaoSupport |
afterPropertiesSet, initDao |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UserDaoHibernate
public UserDaoHibernate()
- Constructor that sets the entity to User.class.
getUsers
public java.util.List<User> getUsers()
- Gets a list of users ordered by the uppercase version of their username.
- Specified by:
getUsers
in interface UserDao
- Returns:
- List populated list of users
saveUser
public User saveUser(User user)
- Saves a user's information.
- Specified by:
saveUser
in interface UserDao
- Parameters:
user
- the object to be saved
- Returns:
- the persisted User object
save
public User save(User user)
- Overridden simply to call the saveUser method. This is happenening
because saveUser flushes the session and saveObject of BaseDaoHibernate
does not.
- Specified by:
save
in interface GenericDao<User,java.lang.Long>
- Overrides:
save
in class GenericDaoHibernate<User,java.lang.Long>
- Parameters:
user
- the user to save
- Returns:
- the modified user (with a primary key set if they're new)
loadUserByUsername
public org.acegisecurity.userdetails.UserDetails loadUserByUsername(java.lang.String username)
throws org.acegisecurity.userdetails.UsernameNotFoundException
- Gets users information based on login name.
- Specified by:
loadUserByUsername
in interface UserDao
- Specified by:
loadUserByUsername
in interface org.acegisecurity.userdetails.UserDetailsService
- Parameters:
username
- the user's username
- Returns:
- userDetails populated userDetails object
- Throws:
org.acegisecurity.userdetails.UsernameNotFoundException
- thrown when user not found in database
Copyright © 2010. All Rights Reserved.