Now I using hql in query. The code is:
return session.createQuery(
"from Company com "
+ " where com.comId = "
+ ":comId and com.phoneNumber = :phoneNumber")
.setString("comId", comId).setString("phoneNumber",
phoneNumber).list();
the phoneNumber in DB is varchar2(255 char), and I using Oracle DB.
But this code can't work in java codes. If the phoneNumber is "999-000-0001", it can work. I can get a record. But if the phoneNumber is "USPersonal", I will not get the record.
In Company.java, the phoneNumber is String, and has get and set methods.
In DB, I using Sql Developer, I can get all of the above.
I don't know, why it is? Is the setString doesn't work?