For more information, see https://glassfish.dev.java.net/issues/show_bug.cgi?id=550.
Manually verify what is wrong in the query.