Last active
January 11, 2018 10:19
-
-
Save Sam-Kruglov/9ee72f3dce7ac15fdc4b3b028b67dadc to your computer and use it in GitHub Desktop.
Projection recursive open
This file contains hidden or 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
public interface UserRepository extends CrudRepository<User, Long> { | |
@RestResource(path = "username", rel = "getUsername") | |
UserUsernameAndGroupName findUsernameAndGroupNameById(@Param("id") Long id); | |
interface UserUsernameAndGroupName { | |
String getUsername(); | |
default String getGroupName() { | |
return getGroup().getName(); | |
} | |
@JsonIgnore | |
GroupName getGroup(); | |
interface GroupName { | |
String getName(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment