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,Long>
      - - com.gisgraphy.dao.hibernate.UserDaoHibernate

- All Implemented Interfaces:
    GenericDao<User,Long>, UserDao, org.springframework.beans.factory.InitializingBean, org.springframework.security.userdetails.UserDetailsService

      public class UserDaoHibernate
      extends GenericDaoHibernate<User,Long>
      implements UserDao, org.springframework.security.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.

- - ### Field Summary

    - ### Fields inherited from class com.gisgraphy.dao.hibernate.GenericDaoHibernate

      `log`

    - ### Fields inherited from class org.springframework.dao.support.DaoSupport

      `logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UserDaoHibernate()` Constructor that sets the entity to User.class.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<User>` | `getUsers()` Gets a list of users ordered by the uppercase version of their username.
    `org.springframework.security.userdetails.UserDetails` | `loadUserByUsername(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 com.gisgraphy.dao.hibernate.GenericDaoHibernate

      `exists, get, getAll, remove`

    - ### 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`

    - ### Methods inherited from interface com.gisgraphy.dao.GenericDao

      `exists, get, getAll, remove`

- - ### Constructor Detail

    - #### UserDaoHibernate

          public UserDaoHibernate()

      Constructor that sets the entity to User.class.

  - ### Method Detail

    - #### getUsers

          public 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,Long>`
      Overrides:
        `save` in class `GenericDaoHibernate<User,Long>`
      Parameters:
        `user` - the user to save
      Returns:
        the modified user (with a primary key set if they're new)

    - #### loadUserByUsername

          public org.springframework.security.userdetails.UserDetails loadUserByUsername(String username)
                                                                                  throws org.springframework.security.userdetails.UsernameNotFoundException

      Gets users information based on login name.
      Specified by:
        `loadUserByUsername` in interface `UserDao`
      Specified by:
        `loadUserByUsername` in interface `org.springframework.security.userdetails.UserDetailsService`
      Parameters:
        `username` - the user's username
      Returns:
        userDetails populated userDetails object
      Throws:
        `org.springframework.security.userdetails.UsernameNotFoundException`

Copyright © 2015. All rights reserved.