org.synyx.hades.sample.dao.simple
Interface SimpleUserDao

All Superinterfaces:
GenericDao<User,java.lang.Long>

public interface SimpleUserDao
extends GenericDao<User,java.lang.Long>

Simple DAO interface for User instances. The interface is used to declare so called finder methods, methods to retrieve single entities or collections of them.

Author:
Oliver Gierke - gierke@synyx.de

Method Summary
 java.util.List<User> findByFirstname(java.lang.String firstname)
          Returns all users with the given firstname.
 java.util.List<User> findByFirstnameOrLastname(java.lang.String name)
          Returns all users with the given name as first- or lastname.
 java.util.List<User> findByLastname(java.lang.String lastname)
          Find all users with the given lastname.
 User findByTheUsersName(java.lang.String username)
          Find the user with the given username.
 
Methods inherited from interface org.synyx.hades.dao.GenericDao
count, delete, delete, deleteAll, exists, flush, readAll, readAll, readAll, readByPrimaryKey, save, save, saveAndFlush
 

Method Detail

findByTheUsersName

User findByTheUsersName(java.lang.String username)
Find the user with the given username. This method will be translated into a query using the NamedQuery annotation at the User class.

Parameters:
lastname -
Returns:

findByLastname

java.util.List<User> findByLastname(java.lang.String lastname)
Find all users with the given lastname. This method will be translated into a query by constructing it directly from the method name as there is no other query declared.

Parameters:
lastname -
Returns:

findByFirstname

@Query(value="from User u where u.firstname = ?")
java.util.List<User> findByFirstname(java.lang.String firstname)
Returns all users with the given firstname. This method will be translated into a query using the one declared in the Query annotation declared one.

Parameters:
firstname -
Returns:

findByFirstnameOrLastname

@Query(value="from User u where u.firstname = :name or u.lastname = :name")
java.util.List<User> findByFirstnameOrLastname(@Param(value="name")
                                                          java.lang.String name)
Returns all users with the given name as first- or lastname. Makes use of the Param annotation to use named parameters in queries. This makes the query to method relation much more refactoring safe as the order of the method parameters is completely irrelevant.

Parameters:
name -
Returns:


Copyright © 2009-2010 Synyx GmbH & Co. KG. All Rights Reserved.