cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Zeigler <>
Subject 2.x, custom (enum) types, mysql, and in expressions?
Date Tue, 24 Jul 2007 20:16:23 GMT
Hi all,

Ran into a strange error recently.
I have a table "Enrollments" with a column "grade" which maps to an  
I was trying to find all enrollments associated with one or more  
particular grades. Basic query looks something like:

SelectQuery q = new SelectQuery(Enrollment.class);

I have a setup where all of my database-facing tests run against an  
in-memory hsql database.  The above worked just fine there. However,  
when I ran the code via the application, which is backed by a mysql  
server (5.0.27), it returned no results.  Everything looked fine when  
I turned on query logging... the queries in the test and in the app  
were identical. So I turned to the mysql query logs and found this  
(truncated to the relevant portions for clarity):

SELECT t0.grade,, t0.studentid FROM enrollments t0, students t1  
WHERE t0.studentid = t1.dbid AND (t0.grade IN ('??\0~r\0! 
\0java.lang.Enum\0\0\0\0\0\0\0\0\0\0xpt\0FIRST', '??\0~r\0! 

This is using version 5.0.4 of the mysql-connector driver.

I changed my test for this particular piece of code to connect to the  
mysql-backed db with the same results as running "live".

Any thoughts? Am I doing something wrong? Seems odd that it works  
with hsqldb, but not mysql?


View raw message