-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See #62. Use Optional wrappers for AccountService
- Loading branch information
Showing
4 changed files
with
25 additions
and
24 deletions.
There are no files selected for viewing
15 changes: 8 additions & 7 deletions
15
src/main/java/com/leanstacks/ws/repository/AccountRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,28 @@ | ||
package com.leanstacks.ws.repository; | ||
|
||
import java.util.Optional; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import com.leanstacks.ws.model.Account; | ||
|
||
/** | ||
* The AccountRepository interface is a Spring Data JPA data repository for | ||
* Account entities. The AccountRepository provides all the data access | ||
* behaviors exposed by <code>JpaRepository</code> and additional custom | ||
* behaviors may be defined in this interface. | ||
* The AccountRepository interface is a Spring Data JPA data repository for Account entities. The AccountRepository | ||
* provides all the data access behaviors exposed by <code>JpaRepository</code> and additional custom behaviors may be | ||
* defined in this interface. | ||
* | ||
* @author Matt Warman | ||
*/ | ||
@Repository | ||
public interface AccountRepository extends JpaRepository<Account, Long> { | ||
|
||
/** | ||
* Query for a single Account entities by username. | ||
* Query for a single Account entity by username. | ||
* | ||
* @param username The username value to query the repository. | ||
* @return An Account or <code>null</code> if none found. | ||
* @return An Optional Account. | ||
*/ | ||
Account findByUsername(String username); | ||
Optional<Account> findByUsername(String username); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters