I want to insert in MySQL database information by my web application. I do it by OpenJPA at TomEE server for example:
public void addLecturer(String name, String surname) {
    Lecturer lect = new Lecturer(name,surname);
    em.persist(lect);
}
where Lecturer is entity class. The problem is that application insert data in latin1 encoding. I want to insert it in UTF-8 encoding.
When I insert data by simple MySQL command in command line terminal i get information in UTF-8 encoding.
I have looked at this and I see character_set_server is set as latin1 but I don't know if this is the problem or how to change it:
mysql> show variables like 'char%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | latin1                     |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
Edit
I have same problem like there:
JPA utf-8 characters not persisted
and
UTF - 8 with JPA and Glassfish 4.0
I add useUnicode=yes, characterEncoding=utf8 and characterSetResults=utf8 to my property javax.persistence.jdbc.url but it doesn't help.
 
     
     
     
     
    