Having a @ReposirotyRestResource
bound to an entity AppUser
and extending the JpaRepository
like this:
@RepositoryRestResource(collectionResourceRel = "users", path = "users")
public interface AppUserRepository extends JpaRepository<AppUser, Long> {
AppUser findByUsername(@Param("username") String username);
}
Where AppUser
looks like this:
@Entity
@Table(name = "app_user")
public class AppUser extends AbstractTimestampEntity {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
// ..
}
I want to receive the id
whenever I want to appUserRepository.findUserByUsername("whatever")
- for some reason the default behavior seems to be to not return this field.
Extra points for either pointing out an error on my side or explain to me why this is the default behavior (and a good idea).