0

I have an entity called forumUser that has several attributes. I want to make custom query and get only the id as a forumUser and leave the rest of attributes so I later add it to different services and dtos. The issue is that when I return the custom query, it cannot be converted to my entity ForumUser.

Query:

   @Query("SELECT p.id FROM ForumUser p WHERE LOWER(p.username) = LOWER(:username) ")
ForumUser find(@Param("username") String username);

Error:

java.util.UUID cannot be cast to com.example.demo.Entity.ForumUser
Chefk5
  • 456
  • 6
  • 14

0 Answers0