1

I'm using the method setString(String name, String val) from Query Class of Hibernate.

import org.hibernate.Query;

String q = "from Table n where n.field=:annee ";
Query query= session.createQuery(q);
query.setString("annee","");

I want to store an empty String and not a null, because this field can not be null in my database. But I get an error message saying that I cant insert a null value.

I don't understand what happens. Because an empty string is not null.

It is the Query method who converts the empty chain into a null, and then Oracle gives me the error?. Or its Oracle itself who converts an empty string into a null, and then it complains?

gcotis
  • 107
  • 2
  • 15

0 Answers0