Method not found on...

#1

I've got this class...

@Entity
@Table(name = "language")
public class Language implements Serializable{
    
    ...
    
    private List<String> aliases;
    
   ...
    
    public boolean hasAlias(List<String> alai) {
       return ... ;
    }

   ...
}

When I try to make this JPQL query: SELECT g from Language g where g.hasAlias("espanol", "italian")

It returns the error: Method 'hasAlias' is not found in type 'Language'

#2

I found out this error too:

Method 'containsAll' is not found in type 'java.util.List'

if I call something like this:

SELECT g from Language g where g.aliases.containsAll("espanol")
#3

hasAlias doesn't expect 2 string arguments. containsAll doesn't expect one string argument.

You have to match both the method name and the method arguments.

In addition, in client-server mode for the server to be able to support user defined methods (such as hasAlias) the relevant code (class files) must be available for the server in its classpath.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login