I am learning spring data close projection. However, it does not give the expected results. This means, instead of the expected interface, it gives org.springframework.aop.framework.JdkDynamicAopProxy. I have researched this for days and I couldn't find the solution. I have attached my code as well.
Entity class - Agent
@Entity
@Table(name = "TBLDMS_AGENT")
public class Agent {
    @Id
    @Column(name = "AGENT_ID")
    private long agentId;
    @Column(name = "AGENT_NAME")
    private String agentName;
    @Column(name = "ADDRESS")
    private String address;
    @Column(name = "CONTACT_NO")
    private String contactNo;
    @Column(name = "STATUS")
    private boolean status;
    @Column(name = "PROFILE_ID")
    private int profileId;
Repository - AgentRepository
@Repository
public interface AgentRepository extends JpaRepository<Agent, Long> {
    @Query(value = 
            "SELECT AGENT_NAME, " +
            "       PROFILE_CODE " +
            "FROM   TBLDMS_AGENT " +
            "WHERE  CONTACT_NO = :number", nativeQuery = true)
    List<AgentInformation> findByContactNumber(@Param("number") String number);
    public static interface AgentInformation {
        String getAgentName();
        String getProfileCode();
    }
}
Usage
        com.dms.agentmanagementservice.persister.AgentRepository.AgentInformation agent = agentRepository.findByContactNumber(number);
        String agentName = agent.getAgentName();
        String profileId = agent.getProfileCode();
But and getting null values for both agentName and profileId. Can someone tell me what I am doing wrong here?
Thank you very much in advance!
 
    