'count(distinct( with an EntityManager

i have an issue with my EntityManager. Comparing, core-SQL with java EntityManager, i do not observe the sames comportments.

in core-SQL (OK)

  select count (distinct p.product_id) from product p ;

equivalent with an EntityManager (OK)

  Query c = entityManager.createQuery("select 
  count(distinct(p.productId))
  from product p");

but now, with two arguments, i got an issue :

in core-SQL (OK)

  select count (distinct (p.product_id , p.product_name)) from product p ;

equivalent with an EntityManager = KO !!!!

  Query c = entityManager.createQuery("select 
  count(distinct(p.productId, p.productName))
  from product p");

EntityManager does not accept two arguments in the distinct clause. i got an exception

  antlr.NoViableAltException: unexpected AST node: {vector}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source