You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Christopher Cudennec <Sm...@gmx.net> on 2011/08/31 18:52:45 UTC
problem with query / German umlaut
Hi!
I have a simple (?) problem with a query against data with German umlaut characters.
Consider the following data:
create table test (property varchar(255));
insert into test values ('Diskontsatze');
insert into test values ('Diskontsätze');
select * from test where prop = 'Diskontsatze';
When querying the database using SQL I get one row as expected. When using the same query with OpenJPA I unexpectedly get two rows. It looks like OpenJPA uses another collation than my table and database.
As database I use MySQL. The default-character-set is "utf8". I tried to set the collation for the table explicitly to 'utf8_unicode_ci' without any positive result.
What could be the problem?
Thanks,
Christopher
--
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!
Jetzt informieren: http://www.gmx.net/de/go/freephone
Re: problem with query / German umlaut
Posted by Christopher Cudennec <Sm...@gmx.net>.
I just wanted to give feedback how I solved that problem:
Since I didn't know how to define the collation in my JPA queries I
decided to change the column definition to utf8_bin. I guess that's the
better choice anyway because utf8_general_ci treats 'a' and 'ä' as the
same character.
Cheers,
Christopher
Am 05.09.2011 03:38, schrieb No1UNo:
> Can't provide much help, but I can testify to having done similar exercises with OpenJAP 2.0 and 2.1 using PostgreSQL without any problem. I recommend logging your SQL statements and verifying that the character encodings are passing through correctly.
>
> On Aug 31, 2011, at 12:53 PM, Christopher Cudennec [via OpenJPA] wrote:
>
>> Hi!
>>
>> I have a simple (?) problem with a query against data with German umlaut characters.
>>
>> Consider the following data:
>>
>> create table test (property varchar(255));
>> insert into test values ('Diskontsatze');
>> insert into test values ('Diskontsätze');
>> select * from test where prop = 'Diskontsatze';
>>
>> When querying the database using SQL I get one row as expected. When using the same query with OpenJPA I unexpectedly get two rows. It looks like OpenJPA uses another collation than my table and database.
>>
>> As database I use MySQL. The default-character-set is "utf8". I tried to set the collation for the table explicitly to 'utf8_unicode_ci' without any positive result.
>>
>> What could be the problem?
>>
>> Thanks,
>>
>> Christopher
>> --
>> NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!
>> Jetzt informieren: http://www.gmx.net/de/go/freephone
>>
>>
>> If you reply to this email, your message will be added to the discussion below:
>> http://openjpa.208410.n2.nabble.com/problem-with-query-German-umlaut-tp6747336p6747336.html
>> To start a new topic under OpenJPA Users, email ml-node+208411-1703014788-244680@n2.nabble.com
>> To unsubscribe from OpenJPA Users, click here.
>
>
> --
> View this message in context: http://openjpa.208410.n2.nabble.com/problem-with-query-German-umlaut-tp6747336p6759586.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: problem with query / German umlaut
Posted by No1UNo <je...@jerrycarter.org>.
Can't provide much help, but I can testify to having done similar exercises with OpenJAP 2.0 and 2.1 using PostgreSQL without any problem. I recommend logging your SQL statements and verifying that the character encodings are passing through correctly.
On Aug 31, 2011, at 12:53 PM, Christopher Cudennec [via OpenJPA] wrote:
> Hi!
>
> I have a simple (?) problem with a query against data with German umlaut characters.
>
> Consider the following data:
>
> create table test (property varchar(255));
> insert into test values ('Diskontsatze');
> insert into test values ('Diskontsätze');
> select * from test where prop = 'Diskontsatze';
>
> When querying the database using SQL I get one row as expected. When using the same query with OpenJPA I unexpectedly get two rows. It looks like OpenJPA uses another collation than my table and database.
>
> As database I use MySQL. The default-character-set is "utf8". I tried to set the collation for the table explicitly to 'utf8_unicode_ci' without any positive result.
>
> What could be the problem?
>
> Thanks,
>
> Christopher
> --
> NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!
> Jetzt informieren: http://www.gmx.net/de/go/freephone
>
>
> If you reply to this email, your message will be added to the discussion below:
> http://openjpa.208410.n2.nabble.com/problem-with-query-German-umlaut-tp6747336p6747336.html
> To start a new topic under OpenJPA Users, email ml-node+208411-1703014788-244680@n2.nabble.com
> To unsubscribe from OpenJPA Users, click here.
--
View this message in context: http://openjpa.208410.n2.nabble.com/problem-with-query-German-umlaut-tp6747336p6759586.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.