source: ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/persistence/jpa/UserDao.java @ 4098

Last change on this file since 4098 was 4098, checked in by George.Georgovassilis@mpi.nl, 10 years ago

#360, #431, #432: JPA and unified component entities

  • Property svn:mime-type set to text/plain
File size: 833 bytes
Line 
1package clarin.cmdi.componentregistry.persistence.jpa;
2
3import java.util.List;
4
5import org.springframework.dao.DataAccessException;
6import org.springframework.data.jpa.repository.JpaRepository;
7import org.springframework.data.jpa.repository.Query;
8
9import clarin.cmdi.componentregistry.model.RegistryUser;
10
11/**
12 *
13 * @author george.georgovassilis@mpi.nl
14 *
15 */
16public interface UserDao extends JpaRepository<RegistryUser, Long>{
17
18        @Query("select u from RegistryUser u order by id")
19        List<RegistryUser> getAllUsers() throws DataAccessException;
20
21        /**
22         *
23         * @param principalName User's principal name
24         * @return User, if it exists
25         * @throws DataAccessException
26         */
27        @Query("select u from RegistryUser u where u.principalName = ?1")
28        RegistryUser getByPrincipalName(String principalName)
29                        throws DataAccessException;
30
31}
Note: See TracBrowser for help on using the repository browser.