jpa – java. Lang. illegalargumentexception: you tried to set a parameter value with a string name that does not exist in the query string
                                        
                    •
                    Java                                    
                I have the following named query: @ h_ 502_ 7@
@NamedQuery(
    name = "Userdetails.findByUsername",query = "SELECT u FROM Userdetails u WHERE u.username = :username"
)
getEntityManager()
    .createNamedQuery("Userdetails.findByUsername")
    .setParameter("string","%" + string + "%")
    .getResultList();
Solution
In your userdetails In the findbyusername naming query, you have a named parameter named Username: @ h_ 502_ 7@
SELECT u FROM Userdetails u WHERE u.username = :username
getEntityManager()
    .createNamedQuery("Userdetails.findByUsername")
    .setParameter("string","%" + string + "%") //<-- check here
    .getResultList();
getEntityManager()
    .createNamedQuery("Userdetails.findByUsername")
    .setParameter("username","%" + string + "%") //<-- check here
    .getResultList();
                
                            The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
                        
                                            
                        THE END
                    
                    
                    
                                                        二维码
                        
                        
                                                
                        