I want to add some russian text into table. It works fine if I will do using MySQL, but not Hibernate.
This makes my text look ????
:
public void addHeadHunter(String city, Integer salary) {
Session session = null;
session = this.sessionFactory.getCurrentSession();
Query query = session
.createSQLQuery(
"INSERT INTO headhunter VALUES(NULL,:city,:salary,NULL)")
.setString("city", city).setInteger("salary", salary);
int updated = query.executeUpdate();
}
What's wrong, comrades?
In your Hibernate config file you'll need to add these properties:
This should allow the use of UTF-8 and support for cyrillic text.