Hi All,
I use Spring Framework and H2 DB. I need to use EclipseLink instead of Hibernate.
I have a query as below. This query can execute on Hibernate but not in EclipseLink.
I searched that passing collection is not supported in NativeQuery.
Jpql does not support WITH RECURSIVE clause and does not see any not entity table in queries also.
How can I execute this query?
Thanks.
@Query(nativeQuery = true, value = "select * from app where id in ( "
+ " WITH RECURSIVE T(N) AS ( " +
"select member from members where member = ?1 " +
"UNION ALL " +
"SELECT user FROM members ,T where member = N " +
") " +
"select USERAPPS.appid from T inner join USERAPPS on T.N=USERAPPS.userid " +
"UNION " +
"select USERAPPS.appid from USERAPPS where USERAPPS.userid = ?1 " +
"UNION " +
"select USERAPPS.appid from USERAPPS where USERAPPS.userid in ( select id from USER where USER.OEM_ID in (select ID from OEM where name in ?2) ) )")
Page<App> findUsersApps(String userId, List<String> oemList, Pageable pageable);