I used an Oracle query hint as described in the OpenJPA documentation: final Query query = em.createQuery("SELECT b FROM Bp b"); query.setHint("openjpa.hint.OracleSelectHint", new Integer(2000)); final List<Bp> result = query.getResultList();
Executing this query fails with "org.apache.openjpa.lib.jdbc.ReportingSQLException: ORA-00923: FROM keyword not found where expected (java.sql.SQLSyntaxErrorException: ORA-00923: FROM keyword not found where expected)". This is the generated query: SELECT 2000 t0.ID [some other attributes left out here] FROM BP t0 Why is OpenJPA generating wrong SQL statements? I also tried to set the query hint in a named query: <named-query name="FIND_ALL_BP"> <query></query> <hint name="openjpa.hint.OptimizeResultCount" value="2000"/> </named-query> final Query namedQuery = em.createNamedQuery(MyQueryNames.FIND_ALL_BP.name()); final List<Bp> result = namedQuery.getResultList(); This query was executed but it did not show any hint. It simply was "SELECT b FROM Bp b" so I guess the hint was just ignored because the SELECT did not perform any faster. Any suggestions on how to successfully use query hints? I'm using Oracle 11g and OpenJPA 1.2.3. -- View this message in context: http://openjpa.208410.n2.nabble.com/Using-Oracle-hint-generates-SQL-syntax-error-tp6775413p6775413.html Sent from the OpenJPA Users mailing list archive at Nabble.com.