I am using Spring boot + Spring Data JPA + PostgreSQL. I have simply class containing some strings.
for example:
public class Person {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String name;
private String surname;
}
I am creating new persons:
Person person = new Person(null, "Roman", "Brzęścikiewicz");
Which contains some polish symbols like "ę" and "ś". When i am saving this to database:
personRepository.save(person);
Then i am left with person saved in database, which received ID and name but not surname example:
id;name;surname
1;Roman;
But when i have surname without polish symbols then i got correct row in database:
id;name;surname
1;Roman;Brzescikiewicz
My application properties:
spring.datasource.url=jdbc:postgresql://localhost:5433/db
spring.datasource.username=user
spring.datasource.password=pass
spring.datasource.driverClassName=org.postgresql.Driver
spring.jpa.hibernate.ddl-auto=validate
Adding ?useUnicode=true&characterEncoding=utf8 As suggested on some qestions on stackoverflow won't work.
Any ideas?