views:

58

answers:

2

Hi there,

I have a Java Web application using GlassFish 3, JSF2.0 (facelets) and JPA (EclipseLink) on MySQL (URL: jdbc:mysql://localhost:3306/administer). The problem I'm facing is that if I'm saving entities to the database with the update() method, String data loses integrity; '?' is shown instead of some characters.

The server, pages and database is/are configured to use UTF-8.

After I post form data, the next page shows the data correctly. Furthermore it "seems" in debug that the String property of the current entity stores the correct value too. Dunno if NetBeans debug can be trusted; might be that it decodes correctly, however it's incorrect.

Any help would be appreciated, thanks in advance! Daniel

A: 

I solved it with the following: I used the GlassFish admin interface to add these two properties to my connection pool's settings:

characterEncoding = UTF-8
wheelie
+2  A: 

It's JDBC, not JPA that determines the encoding:

jdbc:mysql://localhost:3306/administer?characterEncoding=utf8
Bozho