java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: BASE_PARTNER is not mapped [SELECT Max(id) FROM BASE_PARTNER self WHERE isCustomer = 'true' OR isDistributor ='true']

Hello
I ve a problem when i write a request SQL JPA.em(). I need retrieve the max id partner and i write a function in the PartnerServiceImpl.java. I use this code :
first example
` sqlString =
« SELECT Max(id) FROM BASE_PARTNER self WHERE isCustomer = ' »
+ reponse
+ « ’ OR isDistributor =’ »
+ reponse
+ « ’ »;
second example script sql
« SELECT Max(id) FROM BASE_PARTNER WHERE is_Customer = ' »
+ reponse
+ « ’ OR is_Distributor =’ »
+ reponse
+ « ’ »;
BUT HERE I VE ERROR MESSAGE
// get the last customer recorded

long idPartner = (long) JPA.em().createQuery(sqlString).getSingleResult();`

JPA.em().createQuery(sqlString).getSingleResult() is not possible to be executed, can you help me ?
Thanks

I find an other solution to retrieve Max(Id)

private long getMaxId(String object, boolean name) {
String query =
    String.format(
        "SELECT MAX(obj.id) FROM %s obj WHERE obj.isCustomer = ?1 or obj.isDistributor = ?1 ",
        object);

try {
  javax.persistence.Query q = JPA.em().createQuery(query, Long.class);
  q.setParameter(1, name);
  Long queryStr = (Long) q.getSingleResult();

  if (queryStr < 0) return (long) 0;
  else return queryStr;

} catch (NoResultException e) {
  return (long) 0;
}

}
}
and I retrieve my field customerCode with another function in the service

private String getPartner(String object, long id) {

String query = String.format("SELECT obj.customerCode FROM %s obj WHERE obj.id = ?1", object);
try {
  javax.persistence.Query q = JPA.em().createQuery(query, String.class);
  q.setParameter(1, id);
  String queryStr = (String) q.getSingleResult();
  return queryStr;
} catch (NoResultException e) {
  return "";
}

}
It’s seem OK