JpqlSyntaxException: Errors found for input jpql:[INSERT

Hi, I got the following problem. Please help to solve.Thanks.

JpqlSyntaxException: Errors found for input jpql:[INSERT INTO test.test_fd (ID, VERSION, CREATE_TS, CREATED_BY, REF_NO, CIF_NO, AC_NO, CI_NAME, CCY, VAL_DATE, MAT_DATE, PRINCIPLE, ASSIGN_FLAG, PRINT_FLAG, CONFIRM_FLAG) SELECT ID, ‘1’ AS VERSION, NOW() AS CREATE_TS, ‘admin’ as CREATED_BY, REF_NO, CIF_NO, AC_NO, CI_NAME, CCY, VAL_DATE, MAT_DATE, PRINCIPLE, ‘N’ AS ASSIGN_FLAG, ‘N’ AS PRINT_FLAG, ‘N’ AS CONFIRM_FLAG FROM test.tmp_fd WHERE ref_no NOT IN (SELECT ref_no FROM test.test_fd)]
CommonErrorNode [<unexpected: [@0,0:5=‘INSERT’,<55>,1:0], resync=INSERT INTO test.test_fd (ID, VERSION, CREATE_TS, CREATED_BY, REF_NO, CIF_NO, AC_NO, CI_NAME, CCY, VAL_DATE, MAT_DATE, PRINCIPLE, ASSIGN_FLAG, PRINT_FLAG, CONFIRM_FLAG) SELECT ID, ‘1’ AS VERSION, NOW() AS CREATE_TS, ‘admin’ as CREATED_BY, REF_NO, CIF_NO, AC_NO, CI_NAME, CCY, VAL_DATE, MAT_DATE, PRINCIPLE, ‘N’ AS ASSIGN_FLAG, ‘N’ AS PRINT_FLAG, ‘N’ AS CONFIRM_FLAG FROM test.tmp_fd WHERE ref_no NOT IN (SELECT ref_no FROM test.test_fd)>]

Hi,
JPA 2.1 specification doesn’t support INSERT statement in the JPQL query. You can run native SQL statement using

javax.persistence.EntityManager#createNamedQuery(java.lang.String)

See https://doc.cuba-platform.com/manual-6.5/nativeQuery.html
Thanks.

Thanks. I changed to use native sql and the problem had fixed.