Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] special character in database field

Hello:

I'm creating a query in my method using paramaters. Generally it works but it seems to have trouble when the paramater has a special characters.

String str = "<NONE>";
Query qry = em.createQuery("SELECT p FROM Project p WHERE p.projectnumber= :projectnumber , Project.class);
qry.setParameter("projectnumber", str);
Project project = (Project) qry.getSingleResult();

<NONE>, of course, is the value that exists in the database field projectnumber.

I'm using glassfish 4 with postgresql-9.3-1101.jdbc41 jdbc driver.

What is the correct way to handle the strings with special characters in JPA?

--drg



Back to the top