Insert single quote

Hi,

Is there a way to insert single quote data using entity manager nativequery ?

Hi,
I’m not sure I understood your question correctly (very detailed one :slight_smile: ).

I would go this way, by extracting all illegal-for-sql characters into a parameter:

        String param = "'\"`$_&?"; // and other bad characters
        persistence.runInTransaction(em -> {
            em.createNativeQuery("insert into foo (name) values (?)")
                    .setParameter(1, param)
                    .executeUpdate();
        });