He siguiente método:APP getResultList() devuelve BigInteger para MySQL, pero entero para el servidor Microsoft SQL
Query q = getEntityManager().createNativeQuery("SELECT COUNT(1) FROM table1 WHERE column = :column_id " + "UNION " + "SELECT COUNT(1) FROM table2 WHERE column = :column_id");
q.setParameter("column_id", column_id);
Cuando quiero obtener la lista de cuentas (que será de 2 filas), llevo a cabo esta acción :
List<BigInteger> counts = (List<BigInteger>) q.getResultList();
Esto funciona bien en MySQL. Pero tan pronto como me conecto al servidor de MS SQL, estoy obteniendo una lista de objetos Integer:
List<Integer>
Cualquier idea de por qué hay una diferencia?
Su título es al revés. – Hassan
¿Qué implementación de JPA usa? –
¿Intentó explícitamente establecer el tipo de retorno esperado como 'getEntityManager(). CreateNativeQuery (" SELECT COUNT (1) FROM table1 WHERE column =: column_id "+" UNION "+" SELECT COUNT (1) FROM table2 WHERE column =: column_id ", Integer.class);' –