'SQL Syntax error without any informations

I have in my implementation a method that insert data into my database :

try(Connection con = dataSourceOpenIris.getConnection();
       CallableStatement callableStatement = con.prepareCall(String.valueOf(siteRepository.insertSite(creationDemande.getReferenceAccepteurIris(),"test")))){
       res = callableStatement.executeQuery();
   }catch (SQLException e) {
       if (res != null) {
           res.close();
       }
       throw e;
   }

I have the same version of this code for an update and it's working well, but when I launch my app with this method I have this error :

[ERROR] 10:21:51,199  CustomGlobalExceptionHandler.serviceErrorHandler(CustomGlobalExceptionHandler.java:49) – CustomGlobalExceptionHandler > serviceErrorHandler > creation > java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0' at line 1

My request in my repository :

@Transactional
@Modifying
@Query(value = "INSERT INTO #{#entityName} (code,libelle) values (:code, :libelle)", nativeQuery = true)
int insertSite(@Param("code") String code, @Param("libelle") String libelle);

I was first thinking that was a Typo but I can't find it if there is one.

Any help is welcome. Thanks.



Sources

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

Source: Stack Overflow

Solution Source