Список Generi c на сервере веблогов c. Java Джерси 1.x, JPA - PullRequest
0 голосов
/ 05 мая 2020

У меня на двух серверах weblogi c используется один и тот же метод. Один из них - weblogi c 11, а другой - weblogi c 12. Почему мой код не работает в weblogi c 12?

Ошибка:

<Warning> <org.glassfish.jersey.internal.Errors> <BEA-000000> <The following warnings have been 
detected: WARNING: Return type, java.util.List<T>, of method, public <T> java.util.List<T> 
com.apex.api.ApiService.getTable(java.lang.String), is not resolvable to a concrete type.

Возможно ли исправьте, что мой метод работает с weblogi c 12?

@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/getTable")
public <T> List<T> getTable(@QueryParam("table") String tableName) {
    try {
        List<T> jsonList = obtainFacade().obtainAllRecords(tableName);
        return jsonList;
    } catch (Throwable t) {
        t.printStackTrace();
    }
    return null;
}

Я просто получаю каждую таблицу как общую c список

@Override
public <T> List<T> obtainAllRecords(String tableName) throws Exception {

    System.out.println(tableName);
    myEntity table = myEntityFactory.getTable(tableName);
    String tableNamee = table.getClass().getSimpleName();
    try {
        TypedQuery<T> pQuery = (TypedQuery<T>) em.createQuery("SELECT s FROM " + tableNamee + " s");
        return pQuery.getResultList();

    } catch (Throwable t) {
        throw new Exception("database error " + tableNamee + " !" + t);
    }

}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...