This is my Entity Class.
@Entity
public class Profile {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long profileId;
@Transient
private String name;
@ElementCollection(fetch = FetchType.EAGER)
private Map<String, String> trNames; //Key: LanguageCode, Value: translated text
...
}
ProfileRepository Class
public interface ProfileRepository extends JpaRepository<Profile, Long> {
//This method should go through the Map Collection and return a profile whose name matches the given parameter value.
Profile findByTrNames(String code, String name);
}
I created a JUnit Test Class to test this method. This line of code
Profile found = repository.findByTrNames("en", "Interview IT");
throws an exception.
org.springframework.dao.InvalidDataAccessApiUsageException: Parameter value [en] did not match expected type [java.util.Map]; nested exception is java.lang.IllegalArgumentException: Parameter value [en] did not match expected type [java.util.Map]
at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:301)
at etc..
Could anyone please help me?
Thank you very much.