[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-users] Table name turned lower-case and not working
|
Hello Everyone,
I'm new to this group. Nice to meet you all!
What brings me here is a problem I can't find a solution on the net..
On my native query, my table name is in upper-case,
public static final String NATIVE_QUERY_MYSQL_READ_RANDOM =
"select * from MYTABLE order by rand() limit "
+ ApplicationConfig.RESULT_SET_LIMIT;
But when the following is executed, an exception is thrown,
Query queryRandom = em.createNativeQuery(
MyClass.NATIVE_QUERY_MYSQL_READ_RANDOM,
MyClass.class
);
The exception indicates that the table name has been converted to all lower-case.
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'mydatabase.mytable' doesn't exist
Error Code: 1146
Call: SELECT * FROM mytable ORDER BY RAND() LIMIT 10
Query: ReadAllQuery(referenceClass=MyTable sql="SELECT * FROM mytable ORDER BY RAND() LIMIT 10")
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:333)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:644)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:535)
This was not a problem when the server is on a Windows machine, but I recently did this on a unix machine (debian) and it has been not working since due to this exception.
Any suggestion help is much appreciated.. thanks!
Daniel